[Insight-users] Re: Data from IBSR

Luis Ibanez luis.ibanez at kitware.com
Sun Mar 11 07:47:29 EST 2007


Hi Alexandar,

Please take a look at the following email from
the ITK user list archives:

http://public.kitware.com/pipermail/insight-users/2004-December/011402.html

The IBSR data sets are organized in RAW files
accompanied by a README.txt file.


Note that despite the fact that IBSR datasets use the extension ".img",
they *are not* stored in Analyze format. The use of the ".img" extension
is an unfortunate coincidence, that now confuse many of the users who
download data from IBSR, and expect to find the corresponding .hdr
analyze header files.




The easiest way to read them in to ITK is for you to to write
MetaImage headers for them. A metaimage header is a small text
file that describe the dataset.

For a typical IBSR dataset the content of the MetaImage header
looks like:




NDims = 3
DimSize = 256 256 18
ElementSpacing = 0.859375 0.859375 1
Position = 0 0 0
ElementByteOrderMSB = False
ElementType = MET_USHORT
ElementDataFile = 657_2_%d.img 1 18 1


You could put this text in a file called "657_2.mhd"




As you can see from the expression in the last line,
this Header refers to the files:


657_2_10.img
657_2_11.img
657_2_12.img
657_2_13.img
657_2_14.img
657_2_15.img
657_2_16.img
657_2_17.img
657_2_18.img
657_2_1.img
657_2_2.img
657_2_3.img
657_2_4.img
657_2_5.img
657_2_6.img
657_2_7.img
657_2_8.img
657_2_9.img


Note that you should check that the values of
"ElementSpacing" (pixel size) match the values
stated in the IBSR readme file.



You can write the metaimage headers using a simple
text editor, or you could also use the helper program
available in

      InsightApplications/MetaImageImporter

This program will guide you through the process of
composing your MetaImage headers.

Once you have metaimage headers, you simply pass
them to the ImageFileReader as the filename:


typedef itk::Image< unsigned short, 3 >  ImageType;
typedef itk::ImageFileReader< ImageType > ReaderType;

ReaderType::Pointer reader ReaderType::New();

reader->SetFileName("657_2.mhd");

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




Please give it a try to creating MetaImage headers
and let us know if you find any problems.



     Thanks


        Luis



----------------------
Alexandar Jr. wrote:
> Dear Luis Ibanez:
> 
> Could you please help me in reading data either in MATLAB or ITK. I have 
> downloaded data from IBSR. This data is not having *.hdr files. 
> Therefore, I am unable to read and view the MRI data.
> 


More information about the Insight-users mailing list