ImageJ: binary files and HDF5 files exploration of the...
Transcript of ImageJ: binary files and HDF5 files exploration of the...
![Page 1: ImageJ: binary files and HDF5 files exploration of the ...institute.loni.org/.../L2_23Jan_ImageJ_HDF5.pdf · • for ImageJ and Avizo, less memory needed • made from expt. data](https://reader030.fdocuments.net/reader030/viewer/2022040512/5e629c15736c60682d5afbea/html5/thumbnails/1.jpg)
ImageJ: binary files and HDF5 filesexploration of the bullet volume
To prepare:1) Moodle: download Week 1/bullet dataset (binary, 26.8 MB)2) Moodle: download Week 2/bullet dataset (HDF5, 107 MB)3) Launch your ImageJ. Does Plugins/HDF5 exist? If not, double check Week 0/Installing ImageJ (NIH)/Download the HDF5 plugin instructions.
cartridge
1
1
![Page 2: ImageJ: binary files and HDF5 files exploration of the ...institute.loni.org/.../L2_23Jan_ImageJ_HDF5.pdf · • for ImageJ and Avizo, less memory needed • made from expt. data](https://reader030.fdocuments.net/reader030/viewer/2022040512/5e629c15736c60682d5afbea/html5/thumbnails/2.jpg)
In[35]:= 243 ¥ 243 ¥ 227 ¥ 2
Out[35]= 26808246
In[39]:= 243 ¥ 243 ¥ 227 ¥ 8
Out[39]= 107232984
In[40]:= 107235032 - %
Out[40]= 2048
volume_bullet_p134_uint16.bin, 26,808,246 bytesvolume_bullet_p134.h5, 107,235,032 bytes
filenames and file sizes
2
In[24]:= listOfFilenames = FileNames@"volume*", NotebookDirectory@DDMap@ FileByteCount, listOfFilenamesD
Out[24]= 8êUsersêlesbutlerêDocumentsêh4581êvolume_bullet_p134.h5,êUsersêlesbutlerêDocumentsêh4581êvolume_bullet_p134_uint16.bin<Out[25]= 8107235032, 26808246<In[33]:= volume = Import@listOfFilenames@@1DD, 8"Datasets", "êvolume"< D;8rows, columns, slices< = Dimensions@volumeDOut[34]= 8243, 243, 227<
volume_bullet_p134_uint16.bin is stored with 2 bytes per number
volume_bullet_p134.h5is stored with 8 bytes per number plus a headerthat is 2048 bytes long
2
![Page 3: ImageJ: binary files and HDF5 files exploration of the ...institute.loni.org/.../L2_23Jan_ImageJ_HDF5.pdf · • for ImageJ and Avizo, less memory needed • made from expt. data](https://reader030.fdocuments.net/reader030/viewer/2022040512/5e629c15736c60682d5afbea/html5/thumbnails/3.jpg)
volume_bullet_p134_uint16.bin, 26,808,246 bytes
Use ImageJ to inspect the binary file
3
In[24]:= listOfFilenames = FileNames@"volume*", NotebookDirectory@DDMap@ FileByteCount, listOfFilenamesD
Out[24]= 8êUsersêlesbutlerêDocumentsêh4581êvolume_bullet_p134.h5,êUsersêlesbutlerêDocumentsêh4581êvolume_bullet_p134_uint16.bin<Out[25]= 8107235032, 26808246<In[33]:= volume = Import@listOfFilenames@@1DD, 8"Datasets", "êvolume"< D;8rows, columns, slices< = Dimensions@volumeDOut[34]= 8243, 243, 227<
Use ImageJ File/Import/Raw
3
![Page 4: ImageJ: binary files and HDF5 files exploration of the ...institute.loni.org/.../L2_23Jan_ImageJ_HDF5.pdf · • for ImageJ and Avizo, less memory needed • made from expt. data](https://reader030.fdocuments.net/reader030/viewer/2022040512/5e629c15736c60682d5afbea/html5/thumbnails/4.jpg)
volume_bullet_p134.h5, 107,235,032 bytes
Use ImageJ to inspect the HDF5 file
4
In[24]:= listOfFilenames = FileNames@"volume*", NotebookDirectory@DDMap@ FileByteCount, listOfFilenamesD
Out[24]= 8êUsersêlesbutlerêDocumentsêh4581êvolume_bullet_p134.h5,êUsersêlesbutlerêDocumentsêh4581êvolume_bullet_p134_uint16.bin<Out[25]= 8107235032, 26808246<In[33]:= volume = Import@listOfFilenames@@1DD, 8"Datasets", "êvolume"< D;8rows, columns, slices< = Dimensions@volumeDOut[34]= 8243, 243, 227<
Use ImageJ File/Import/Raw
4
![Page 5: ImageJ: binary files and HDF5 files exploration of the ...institute.loni.org/.../L2_23Jan_ImageJ_HDF5.pdf · • for ImageJ and Avizo, less memory needed • made from expt. data](https://reader030.fdocuments.net/reader030/viewer/2022040512/5e629c15736c60682d5afbea/html5/thumbnails/5.jpg)
volume_bullet_p134.h5, 107,235,032 bytes
Use ImageJ to inspect the HDF5 file
5
In[24]:= listOfFilenames = FileNames@"volume*", NotebookDirectory@DDMap@ FileByteCount, listOfFilenamesD
Out[24]= 8êUsersêlesbutlerêDocumentsêh4581êvolume_bullet_p134.h5,êUsersêlesbutlerêDocumentsêh4581êvolume_bullet_p134_uint16.bin<Out[25]= 8107235032, 26808246<In[33]:= volume = Import@listOfFilenames@@1DD, 8"Datasets", "êvolume"< D;8rows, columns, slices< = Dimensions@volumeDOut[34]= 8243, 243, 227<
Use ImageJ Plugins/HDF5/Load HDF5
5
![Page 6: ImageJ: binary files and HDF5 files exploration of the ...institute.loni.org/.../L2_23Jan_ImageJ_HDF5.pdf · • for ImageJ and Avizo, less memory needed • made from expt. data](https://reader030.fdocuments.net/reader030/viewer/2022040512/5e629c15736c60682d5afbea/html5/thumbnails/6.jpg)
volume_bullet_p134_uint16.bin, 26,808,246 bytes
Use ImageJ to inspect the binary file
6
In[24]:= listOfFilenames = FileNames@"volume*", NotebookDirectory@DDMap@ FileByteCount, listOfFilenamesD
Out[24]= 8êUsersêlesbutlerêDocumentsêh4581êvolume_bullet_p134.h5,êUsersêlesbutlerêDocumentsêh4581êvolume_bullet_p134_uint16.bin<Out[25]= 8107235032, 26808246<In[33]:= volume = Import@listOfFilenames@@1DD, 8"Datasets", "êvolume"< D;8rows, columns, slices< = Dimensions@volumeDOut[34]= 8243, 243, 227<
Use ImageJ File/Import/Raw
6
![Page 7: ImageJ: binary files and HDF5 files exploration of the ...institute.loni.org/.../L2_23Jan_ImageJ_HDF5.pdf · • for ImageJ and Avizo, less memory needed • made from expt. data](https://reader030.fdocuments.net/reader030/viewer/2022040512/5e629c15736c60682d5afbea/html5/thumbnails/7.jpg)
7
volu
me_
bulle
t_p1
34_u
int1
6.bi
nvo
lum
e_bu
llet_
p134
.h5
unsigned integer-16• smaller files• for ImageJ and Avizo, less memory needed• made from expt. data by rescaling• Note: 0=black and 65535=white.These are {min,max} values in the data.
real-64• this is original data• numbers can be related back to neutron attenuation values. For example, the values for air should be very close to zero.• Note: -0.128=black and 0.178=white. These are {min,max} values in the data.
Make histogram with Analyze/Histogram
7
![Page 8: ImageJ: binary files and HDF5 files exploration of the ...institute.loni.org/.../L2_23Jan_ImageJ_HDF5.pdf · • for ImageJ and Avizo, less memory needed • made from expt. data](https://reader030.fdocuments.net/reader030/viewer/2022040512/5e629c15736c60682d5afbea/html5/thumbnails/8.jpg)
volu
me_
bulle
t_p1
34_u
int1
6.bi
nvo
lum
e_bu
llet_
p134
.h5
Adjust limits of colormap with Image/Adjust/BrightnessContrast... and select “Auto”. According to histograms, data values are not changed. Why has the appearance the of image change?
8
![Page 9: ImageJ: binary files and HDF5 files exploration of the ...institute.loni.org/.../L2_23Jan_ImageJ_HDF5.pdf · • for ImageJ and Avizo, less memory needed • made from expt. data](https://reader030.fdocuments.net/reader030/viewer/2022040512/5e629c15736c60682d5afbea/html5/thumbnails/9.jpg)
volu
me_
bulle
t_p1
34_u
int1
6.bi
n Select the smaller file (....uint16.bin) and Image/Stacks/Orthogonal ViewsNavigate to YZ 51
The bright arc is a flaw in the detector.Please don’t try to enhance this flaw in your Avizo work.
9
![Page 10: ImageJ: binary files and HDF5 files exploration of the ...institute.loni.org/.../L2_23Jan_ImageJ_HDF5.pdf · • for ImageJ and Avizo, less memory needed • made from expt. data](https://reader030.fdocuments.net/reader030/viewer/2022040512/5e629c15736c60682d5afbea/html5/thumbnails/10.jpg)
volu
me_
bulle
t_p1
34_u
int1
6.bi
nvo
lum
e_bu
llet_
p134
.h5
Select the smaller file (....uint16.bin) and Plugins/3D/Volume Viewer
10
![Page 11: ImageJ: binary files and HDF5 files exploration of the ...institute.loni.org/.../L2_23Jan_ImageJ_HDF5.pdf · • for ImageJ and Avizo, less memory needed • made from expt. data](https://reader030.fdocuments.net/reader030/viewer/2022040512/5e629c15736c60682d5afbea/html5/thumbnails/11.jpg)
11
![Page 12: ImageJ: binary files and HDF5 files exploration of the ...institute.loni.org/.../L2_23Jan_ImageJ_HDF5.pdf · • for ImageJ and Avizo, less memory needed • made from expt. data](https://reader030.fdocuments.net/reader030/viewer/2022040512/5e629c15736c60682d5afbea/html5/thumbnails/12.jpg)
Some common errors with Import/Raw
correct settings
wrong endian
wrong dimension order
wrong number format
12
![Page 13: ImageJ: binary files and HDF5 files exploration of the ...institute.loni.org/.../L2_23Jan_ImageJ_HDF5.pdf · • for ImageJ and Avizo, less memory needed • made from expt. data](https://reader030.fdocuments.net/reader030/viewer/2022040512/5e629c15736c60682d5afbea/html5/thumbnails/13.jpg)
Some common errors with Plugins/HDF5/Load HDF5
correct settings
HDF5 is a “self-describing” file format and is largely free of data import problems.“HDFView” is a free Java program for inspecting HDF5 files. Good for validating files.
http://www.hdfgroup.org/HDF5/
13
![Page 14: ImageJ: binary files and HDF5 files exploration of the ...institute.loni.org/.../L2_23Jan_ImageJ_HDF5.pdf · • for ImageJ and Avizo, less memory needed • made from expt. data](https://reader030.fdocuments.net/reader030/viewer/2022040512/5e629c15736c60682d5afbea/html5/thumbnails/14.jpg)
http://www.vsg3d.com/avizo®-faqs-and-user-documentation
As yet, Avizo does not support HDF5.
14
![Page 15: ImageJ: binary files and HDF5 files exploration of the ...institute.loni.org/.../L2_23Jan_ImageJ_HDF5.pdf · • for ImageJ and Avizo, less memory needed • made from expt. data](https://reader030.fdocuments.net/reader030/viewer/2022040512/5e629c15736c60682d5afbea/html5/thumbnails/15.jpg)
HW 1: ImageJ
due Monday, 30 Jan
reproduce the common binary import errors.
Suggestion: try the errors from class and make up some of your own errors.
15
![Page 16: ImageJ: binary files and HDF5 files exploration of the ...institute.loni.org/.../L2_23Jan_ImageJ_HDF5.pdf · • for ImageJ and Avizo, less memory needed • made from expt. data](https://reader030.fdocuments.net/reader030/viewer/2022040512/5e629c15736c60682d5afbea/html5/thumbnails/16.jpg)
Wednesday: Mathematica and data import.
16