[ITK] [ITK-users] Extensions to the MetaImage (MHDs) IO-plugin to support compression and MHAs
Dr. Roman Grothausmann
grothausmann.roman at mh-hannover.de
Mon Jul 28 10:23:20 EDT 2014
Dear mailing list members,
I've extended the MetaImage (used by e.g. ITK/VTK) IO-plugin from Kang Li
(http://www.kangli.org/code/MetaImage_Reader_Writer.html) to also support
compression and local data storage, i.e. MHAs. The MetaImage Reader/Writer from
(http://ij-plugins.sourceforge.net/plugins/3d-io/) seems not to support this
either.
Reading and writing in Fiji was tested with MHDs and MHAs created/read by
ITK-4.5.1. While the plugin handles files bigger than 4GB correctly, (for
unknown reasons my) ITK seems to have problems with MHDs/MHAs bigger than 4GB
(in general).
The plugin does not check whether the size of the compressed data is correct,
ITK however does. If the header lacks an entry of CompressedDataSize, ITK throws
an error when reading/loading such a file. If the size specified with
CompressedDataSize is too big, ITK just issues a warning. This was used as a
workaround because I did not find an easy way in Java to put the correct value
for CompressedDataSize without using extra temporary files (which might be quite
big).
Attached are the modified files (java-files, plugins.config and a repacked
IO_-2.0.0-SNAPSHOT.jar).
A modified HandleExtraFileTypes.java (based on:
https://github.com/fiji/IO/blob/master/src/main/java/HandleExtraFileTypes.java)
is also included.
Togehter with the modified Plugin it allows opening MHDs and MHAs directly.
The repacked IO_-2.0.0-SNAPSHOT.jar was generated with:
javac -cp /opt/fiji/Fiji.app/jars/ij-1.48a.jar:. MetaImage_Reader.java
javac -cp /opt/fiji/Fiji.app/jars/ij-1.48a.jar:. MetaImage_Writer.java
javac -cp /opt/fiji/Fiji.app/jars/ij-1.48a.jar:. MetaImage_CWriter.java
javac -cp /opt/fiji/Fiji.app/jars/ij-1.48a.jar:. HandleExtraFileTypes.java
The compiled Class-files were moved to a subfolder named io/:
ExtendedFileOpener.class MetaImage_CWriter.class MetaImage_Writer.class
ExtendedFileSaver.class MetaImage_Reader.class ReplacingInputStream.class
And then included/replaced with zip:
zip -r IO_-2.0.0-SNAPSHOT.jar plugins.config HandleExtraFileTypes.class io/
Feel free to add these extensions to the Plugin-Page or the ImageJ/Fiji repository.
Any suggestions concerning improvements are very welcome.
Many thanks for ImageJ/Fiji and the initial Metaimage IO-plugin.
Roman
--
Dr. Roman Grothausmann
Tomographie und Digitale Bildverarbeitung
Tomography and Digital Image Analysis
Institut für Funktionelle und Angewandte Anatomie, OE 4120
Medizinische Hochschule Hannover
Carl-Neuberg-Str. 1
D-30625 Hannover
Tel. +49 511 532-9574
-------------- next part --------------
A non-text attachment was scrubbed...
Name: HandleExtraFileTypes.java
Type: text/x-java
Size: 16846 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/community/attachments/20140728/d5513378/attachment-0004.java>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: MetaImage_CWriter.java
Type: text/x-java
Size: 11063 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/community/attachments/20140728/d5513378/attachment-0005.java>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: MetaImage_Reader.java
Type: text/x-java
Size: 17777 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/community/attachments/20140728/d5513378/attachment-0006.java>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: MetaImage_Writer.java
Type: text/x-java
Size: 6219 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/community/attachments/20140728/d5513378/attachment-0007.java>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: MetaImageIO.patch
Type: text/x-patch
Size: 17205 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/community/attachments/20140728/d5513378/attachment-0002.bin>
-------------- next part --------------
# Author: Roman Grothausmann
File>Save As, "MHD/MHA ...", io.MetaImage_Writer
File>Save As, "MHD/MHA compressed ...", io.MetaImage_CWriter
File>Import, "MHD/MHA...", io.MetaImage_Reader
# Author: Stephan Saalfeld
File>Save As, "DF3 ...", io.Save_DF3
File>Import, "DF3...", io.Open_DF3
# Author: Stephan Preibisch
File>Import, "FIB-SEM ...", io.FIBSEM_Reader
# by Albert Cardona:
File>Import, "MRC Leginon ...", io.Open_MRC_Leginon
File>Import, "PDF ...", io.PDF_Viewer
File>Import, "Extract Images From PDF...", io.Extract_Images_From_PDF
File>Import, "DAT EMMENU ...", io.Open_DAT_EMMENU
# by Greg Jefferis
File>Import, "DM3 Reader...", io.DM3_Reader
File>Import, "TorstenRaw GZ Reader...", io.TorstenRaw_GZ_Reader
File>Import, "Nrrd ...", io.Nrrd_Reader
File>Save As, "Nrrd ... ", io.Nrrd_Writer
# by Johannes Schindelin
File>Import, "ICO...", io.ICO_Reader
File>Save As, "ICO ...", io.ICO_Writer
File>Import, "Icns...", io.Icns_Reader
File>Save As, "Icns ...", io.Icns_Writer
File>Import, "SVG...", io.SVG_Reader
File>Save As, "XPM ...", io.XPM_Writer
File>Import, "LSS16...", io.LSS16_Reader
File>Save As, "LSS16 ...", io.LSS16_Writer
# others:
File>Import, "IPLab Reader...", io.IPLab_Reader
File>Save As, "PDF ... ", io.PDF_Writer
File>Import, "Animated Gif...", io.Animated_Gif_Reader
File>Save As, "Animated Gif ... ", io.Gif_Stack_Writer
File>Save As, "EPS ...", io.Export_EPS
-------------- next part --------------
A non-text attachment was scrubbed...
Name: IO_-2.0.0-SNAPSHOT.jar
Type: application/x-java-archive
Size: 149064 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/community/attachments/20140728/d5513378/attachment-0003.bin>
-------------- next part --------------
_____________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Kitware offers ITK Training Courses, for more information visit:
http://www.kitware.com/products/protraining.php
Please keep messages on-topic and check the ITK FAQ at:
http://www.itk.org/Wiki/ITK_FAQ
Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/insight-users
More information about the Community
mailing list