[Insight-users] Conversion slices(.img) -> volume : IBSR Data to MetaImage

Luis Ibanez luis.ibanez at kitware.com
Sat Mar 5 13:18:12 EST 2005


Hi Arnaud,

The images from the IBSR project use extensions .img but
are NOT in Analyze format. This is an unfortunate coincidence
in the use of the ".img" extension. The IBSR files are RAW files,
so there is no direct way of reading them without having to specify
all the MetaData such as origin, spacing, number of pixels...


You can load the set of .img image into a volume by simply
creating a MetaImage header for them. The header MUST be
placed in the same directory as the .img files.



Please look at the following email posted
to the list on December 13 2004:

http://www.itk.org/pipermail/insight-users/2004-December/011402.html




Here are two examples of headers for the IBSR datasets



File: 657_2_img.mhd, for one of the dataset in in 657.tar.Z:


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


Just put the lines above into a text file named "657_2_img.mhd" and
copy it in the same directory where you have .img image. At this
point you will be able to read them as a volume by just passing the
name "657_2_img.mhd" as the input filename to any ITK program that
reads 3D datasets.



Another example:

File: 657_8_img.mhd, for one of the dataset in in 657.tar.Z

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





Regards,


     Luis




-----------------------------
Devalkeneer Arnaud wrote:

> Hi everybody,
> 
> I explain you my problem : I try to use ibsr image
> data with my program based on itk, but i can not find
> any way to read directly the images with the "img"
> extension.
> 
> It is the set of images with prefix 657_2 wich
> contains 18 slices. I want to create a gipl volume
> with these data. I wrote a small program (inspired of
> the 011264.html (ITK mailing of November 2004) ) to do
> this but the execution failed . Here are the error:
> 
> "Error reading the series
> itk::ExceptionObject (0x80f5078)
> Location: "Unknown"
> Description: File cannot be read"
> 
> I checked the filenames serie by printing these on the
> console. It is OK : it is the true paths to image
> files. But it seems that it is the reading of the .img
> images fails. 
> 
> I know that I can convert manually these "img" images
> to dicom format with e.g. Osiris before proceeding
> with ITK. Also I know the solution of writing a header
> file but I want to create an automatic way for the
> next conversions slices->volume that I will need. 
> 
> Is there rather no way to directly work with only ITK?
> 
> 
> Thanks a lot in advance for your help.
> 
> Arnaud
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around 
> http://mail.yahoo.com 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> 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