Wiki source code of Access data with ImageJ

Version 13.1 by fwilde on 2016/09/15 09:23

Hide last authors
fwilde 3.1 1 {{layout}}
2 {{layout-section ac:type="two_right_sidebar"}}
3 {{layout-cell}}
fwilde 1.1 4 Currently, at P05 a generic data format is used to store raw and reconstructed data. Generally, this is a binary format in little endian byte order with different data types (uint16, real32, ...) and a header which describes the dataset (rows and columns, data format). This data can either be imported directly in ImageJ or loaded with our plugins.
5
fwilde 8.1 6 = {{id name="AccessdatawithImageJ-Readthefileheader"/}}Read the file header =
fwilde 1.1 7
fwilde 8.1 8 Each image contains a header consisting of the information needed to open the binary raw file. To read the header open the first line of the dataset (e.g. with the {{code language="none"}}head{{/code}} command in Linux or in an editor). The header information is subdivided with underscore symbols, like e.g. {{code language="none"}}PC_2_U_2000_2000_{{/code}}. The first item describes on what kind of computer the data was generated. The second item shows the dimensionailty of the data (2 for an image). The next item is a letter (either B U I L or F ) and describes the data type. A list of te data types can be found in the table below. The last items give the length of the dataset in each dimension. The total header length is not fixed and generally depends on the image dimensions.and count all letters until the carriage return. Add 2 to this number (carriage return has two letters) and this is the header length - e.g. {{code language="none"}}PC_2_U_2000_2000_{{/code}} has 17 letters ansd thus results in a header length of 19.
fwilde 1.1 9
fwilde 11.1 10 (% class="wrapped" %)
fwilde 1.1 11 |=(((
12 suffix
13 )))|=(((
fwilde 9.1 14 ImageJ data type
fwilde 1.1 15 )))|=(((
16 header tag
17 )))
18 |(((
19
20 )))|(((
fwilde 9.1 21 8 bit
fwilde 1.1 22 )))|(((
23 B
24 )))
25 |(((
26 .img .dar .ref
27 )))|(((
fwilde 9.1 28 16 bit Unsigned
fwilde 1.1 29 )))|(((
30 U
31 )))
32 |(((
33
34 )))|(((
fwilde 9.1 35 16 bit Signed
fwilde 1.1 36 )))|(((
37 I
38 )))
39 |(((
40
41 )))|(((
fwilde 9.1 42 32 bit Signed
fwilde 1.1 43 )))|(((
44 L
45 )))
46 |(((
47 .sli .sin .sis
48 )))|(((
fwilde 9.1 49 32 bit Real
fwilde 1.1 50 )))|(((
51 F
52 )))
53
fwilde 8.1 54 = {{id name="AccessdatawithImageJ-Importrawdatadirectly"/}}Import raw data directly =
55
fwilde 10.1 56 With ImageJ you can import binary data directly using {{code language="none"}}File > Import > Raw...{{/code}}. To import the raw data directly, read the header of the file you want to open, enter the values:
fwilde 8.1 57
fwilde 10.1 58 * Image type (see table ImageJ data type)
59 * Width and height (last two numbers in header)
60 * Offset to first image (i.e. header length)
61
62 and check the box {{code language="none"}}Little-endian byte order{{/code}}. You can choose to {{code language="none"}}Open all files in folder{{/code}} if you want to open a stack with all file in a folder. **Attention**: {{code language="none"}}Use virtual stack{{/code}} does not work with this kind of import. To open a virtual stack you need to use our plugins.
63
fwilde 8.1 64 [[image:attach:imagej_raw_import.png||height="250"]]
65
fwilde 1.1 66 = {{id name="AccessdatawithImageJ-UsetheImageJplugins"/}}Use the ImageJ plugins =
67
fwilde 13.1 68 In order to read the P05 data with our plugin, you have at least to install the {{code language="none"}}read_dat.class{{/code}}. Simply copy the file into your local ImageJ plugins folder. If you want to be able to open the data with the standard {{code language="none"}}File -> Open...{{/code}} Menu button, you addtionally have to install the ##(% style="color: rgb(0,0,0);" %)HandeExtraFileTypes.class(%%)##(% style="color: rgb(0,0,0);" %). With this plugin you can also import an image stack as a virtual stack.
fwilde 1.1 69
fwilde 8.1 70 {{info}}
71 There appear to be some issues with our plugins using Fiji (ImageJ with extended plugins). If you are using Fiji and encounter problems with our plugins try using ImageJ instead.
72 {{/info}}
73
74 (% style="color: rgb(0,0,0);" %)
75
76
fwilde 4.1 77 = {{id name="AccessdatawithImageJ-Downloads"/}}Downloads =
fwilde 1.1 78
fwilde 11.1 79 {{panel borderColor="blue" titleColor="white" titleBGColor="blue" title="ImageJ Plugins"}}
fwilde 6.1 80 **Binary files to copy to your plugin folder:**
81
fwilde 11.1 82 [[attach:HandleExtraFileTypes.class]]
83
fwilde 8.1 84 [[attach:read_dat.class]]
fwilde 6.1 85
86 **Source code:**
87
88 [[attach:HandleExtraFileTypes.java]]
89
90 [[attach:read_dat.java]]
fwilde 2.1 91 {{/panel}}
fwilde 6.1 92
fwilde 7.1 93
fwilde 6.1 94
95
fwilde 3.1 96 {{/layout-cell}}
97
98 {{layout-cell}}
99
100
101 {{toc/}}
102 {{/layout-cell}}
103 {{/layout-section}}
104 {{/layout}}