[Insight-users] Reading 3D Binary Volumes

Luis Ibanez luis.ibanez at kitware.com
Thu Oct 22 13:17:03 EDT 2009


Hi Aya,

You can do this with the

                 itkImportImageFilter

Please see the description of this filter in the
ITK Software Guide:

     http://www.itk.org/ItkSoftwareGuide.pdf


You will also find useful the following tutorial:

"Integrating ITK with your application"
http://www.itk.org/CourseWare/Training/GettingStarted-V.pdf


      Regards,


              Luis



---------------------------------------------
On Thu, Oct 22, 2009 at 12:42 PM, Aya El Gebeely
<aya.elgebeely at symbyo.com> wrote:
> Sorry I meant itk::Image "itkImage.h"
>
> Regards,
> Aya R. ElGebeely
> Software Engineer
> Symbyo Technologies
>
>
> 2009/10/22 Luis Ibanez <luis.ibanez at kitware.com>
>>
>> Hi Aya,
>>
>> In order to advice you,
>>
>> we first need you to tell us what is an:
>>
>>             ItkSFDataImage
>>
>>
>>
>>      Thanks,
>>
>>              Luis
>>
>>
>> --------------------------------------------------------------------
>> On Thu, Oct 22, 2009 at 12:23 PM, Aya El Gebeely
>> <aya.elgebeely at symbyo.com> wrote:
>> > Hi Luis,
>> >
>> > Thanks for your reply .. it was very  beneficial
>> >
>> > Actually we have our own pipeline for reading a DICOM directory and
>> > loading
>> > into memory.. but let me ask you another question if don't mind :
>> >
>> > Using our pipeline we already have in memory the whole volume pixel data
>> > as
>> > well as ,  DICOM info ..
>> >
>> > Actually I've a pointer to the volume data in memory ..
>> >
>> > How could I load  the volume data into an ItkSFDataImage and its data as
>> > well , to be able to apply various  ITK filters on it?
>> >
>> >
>> > Regards,
>> > Aya R. ElGebeely
>> > Software Engineer
>> > Symbyo Technologies
>> >
>> >
>> > 2009/10/22 Luis Ibanez <luis.ibanez at kitware.com>
>> >>
>> >> Hi Aya,
>> >>
>> >> The simplest way of loading a "raw" binary file into ITK is
>> >> to write a MetaImage header for it.
>> >>
>> >> This is simply a text header file, that you will put in the same
>> >> directory as your binary file.
>> >>
>> >> As described in:
>> >> http://www.itk.org/ITK/resources/links.html
>> >>
>> >> The minimal MetaImage header would be a file with extension
>> >> ".mhd", named for example:
>> >>
>> >>                             "image.mhd"
>> >>
>> >> with content such as:
>> >>
>> >> NDims = 3
>> >> DimSize = 181 217 181
>> >> ElementType = MET_UCHAR
>> >> ElementSpacing = 1.2 1.2 3.4
>> >> Offset = 13.4 27.5 43.2
>> >> ElementByteOrderMSB = False
>> >> ElementDataFile = myBinaryFile.raw
>> >>
>> >>
>> >> Where, of course, you will have to replace the
>> >> "myBinaryFile.raw" with the actual filename of
>> >> your binary file.
>> >>
>> >> The DimSize field with the actual number of pixels
>> >> along each dimension of your image.
>> >>
>> >> The ElementType with the pixel type of the data.
>> >> Presumably you are doing CT or MRI, and in that
>> >> case you want to use the pixel type MET_SHORT.
>> >>
>> >> Offset should have the coordinates of the image
>> >> origin.
>> >>
>> >> All that said,
>> >> Please note that you could could have just read
>> >> the DICOM image directly into ITK, as explained
>> >> in the ITK Software Guide
>> >>
>> >>      http://www.itk.org/ItkSoftwareGuide.pdf
>> >>
>> >> in the "Reading and Writing Images" Chapter.
>> >>
>> >> You will find source code examples on how to
>> >> read DICOM  images in the directory:
>> >>
>> >>            Insight/Examples/IO
>> >>
>> >>
>> >> The other options that you mention are also valid.
>> >>
>> >> You could read the image as DICOM and save it
>> >> as a .vtk legacy file (although in this case the
>> >> direction cosines will be lost... but you already
>> >> lost them anyways in your current process of
>> >> saving only the binary data).
>> >>
>> >> You could also save the image as an Analyze
>> >> or Nifti image file format. But please note that
>> >> Analyze only supports three image orientations.
>> >>
>> >> My suggestion will be to save the image using
>> >> the MetaImage file format, or to keep it as a
>> >> DICOM file.  Those are the two options that
>> >> will keep the largest amount of information about
>> >> your image.
>> >>
>> >>
>> >>    Regards,
>> >>
>> >>
>> >>           Luis
>> >>
>> >>
>> >>
>> >> ------------------------------------------------------------------------------
>> >> On Thu, Oct 22, 2009 at 10:26 AM, Aya El Gebeely
>> >> <aya.elgebeely at symbyo.com> wrote:
>> >> > Dear Luis,
>> >> >
>> >> ...
>> >> >
>> >> > I 've a question concerning  reading 3D images & applying ITK filters
>> >> > on
>> >> > 3D
>> >> > images.
>> >> >
>> >> > I have 3D volumes that were constructed from DICOM series & were
>> >> > saved
>> >> > in
>> >> > Binary Files. [the pixel data]
>> >> >
>> >> > Here is the issue :
>> >> >
>> >> > I need to reconstruct the volume, and apply some ITK filters on it
>> >> > such
>> >> > as
>> >> > segmentation, Diluting, Laplacian and others
>> >> >
>> >> > I'm facing a problem in reading the binary file using ItkImageReader,
>> >> > it
>> >> > fails to load pixel data.
>> >> >
>> >> > - Should I use another kind of reader with the binary volume ?
>> >> > - Should I stop using binary file and save the volume in another
>> >> > format
>> >> > ?
>> >> >
>> >> > What is your opinion about this problem ?
>> >> >
>> >> > Thanks in advance and waiting for your reply :)
>> >> >
>> >> > Best Regards,
>> >> > Aya R. ElGebeely
>> >> > Software Engineer
>> >> > Symbyo Technologies
>> >> >
>> >
>> >
>
>


More information about the Insight-users mailing list