[Insight-users] How to combine 2D raw images to a 3D raw image

Luis Ibanez luis.ibanez at kitware.com
Mon Nov 1 10:01:39 EST 2004


Hi Christian,

You can simply create a MetaImage header for your files.

For example, the following MetaImage header will refer
to a volume of 168 raw slices named

     myRawFile000.raw
     myRawFile001.raw
     myRawFile002.raw
...
     myRawFile167.raw


--------------- myImage.mhd ----------------------
NDims = 3
DimSize = 512 512 168
ElementSpacing = 1 1 3
Position = 10 20 15
ElementByteOrderMSB = False
ElementType = MET_UCHAR
ElementDataFile = myRawFile%03i.raw 0 167 1
--------------------------------------------------


For a description on MetaImage headers and how to use
them please look at the "Data" link:

     http://www.itk.org/HTML/Data.htm


Once you have created the MetaImage header, you
can load your volume by using simple code like the
following

====================================================
  typedef itk::Image< char, 3 >   ImageType;
   typedef itk::ImageFileReader< ImageType > ReaderType;
   ReaderType::Pointer reader = ReaderType::New();

   reader->SetFileName("myImage.mhd");

   try
      {
      reader->Update();
      }
   catch( itk::ExceptionObject & excp )
      {
      std::cerr << "error " << excp << std::endl;
      return;
      }

   ImageType::ConstPointer image = reader->GetOutput();
=========================================================


Please let us know if you have further questions,


    Thanks,



       Luis



------------------------
Christian Dold wrote:

> Hi insight user and programers
> I try to built a 3D volume from 12 raw files in 2D. I am able to load
> one raw file seperately but not the hole volume including the 12 raw
> files. With MRI-Converts it doesnt work eighter.
> Thanks
> Chris
> 
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
> 
> 






More information about the Insight-users mailing list