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

Luis Ibanez luis.ibanez at kitware.com
Tue Nov 2 15:08:48 EST 2004


Hi Christian,

Here are the errors in your MetaImage header

1) You inserted an arbitraty token  "HEART_RATE"

2) You set the slices counter to increment by 5
    instead of by 1.

    that is, your printf expresion had  4 15 5
    and it should have been             4 15 1

3) Your filenames are not formatted at 2 characters
    like

     00,01,02... 09

    but like

      1,2,.... 9

    so the printf expression should be;

               Anonymized-Go._1_%i.raw

    instead of

               Anonymized-Go._1_%02i.raw



To summarize,
Here is the corrected MetaImage header for your files:

-------------------------------------------------------
NDims = 3
DimSize = 256 224 12
ElementSpacing = 1.36719 1.36719 8
Position = 0 0 0
ElementByteOrderMSB = 0
ElementType = MET_USHORT
HeaderSize = -1
ElementDataFile = Anonymized-Go._1_%i.raw 4 15 1
-------------------------------------------------------

Note that you can also put the explicit list of filenames
like

--------------------------------------------------------
NDims = 3
DimSize = 256 224 12
ElementSpacing = 1.36719 1.36719 8
Position = 0 0 0
ElementByteOrderMSB = 0
ElementType = MET_USHORT
HeaderSize = -1
ElementDataFile = LIST
Anonymized-Go._1_4.raw
Anonymized-Go._1_5.raw
Anonymized-Go._1_6.raw
Anonymized-Go._1_7.raw
Anonymized-Go._1_8.raw
Anonymized-Go._1_9.raw
Anonymized-Go._1_10.raw
Anonymized-Go._1_11.raw
Anonymized-Go._1_12.raw
Anonymized-Go._1_13.raw
Anonymized-Go._1_14.raw
Anonymized-Go._1_15.raw
--------------------------------------------------------


Regards,


     Luis




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

> Hi Luis
> it is still not working
> attached the anomyzed images from dicomworks and the .mhd file i am using
> My application is loading only 3 slices :-(
> 
> Regards
> Christian
> 
> Luis Ibanez wrote:
> 
> 
>>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
>>>
>>>
>>
>>
>>
>>
>>_______________________________________________
>>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