[Insight-users] Re: Reading VMR files in ITK

Luis Ibanez luis . ibanez at kitware . com
Thu, 31 Jul 2003 10:25:25 -0400


Hi Marcellus,

ITK does not have a reader for VMR files,
but looking at the file format
http://www . brainvoyager . de/BV2000OnlineHelp/BrainVoyagerWebHelp/mergedProjects/FileFormats/The_format_of_VMR_files . htm

It seems that a pretty easy way to read those files is to
create the MetaImage headers for them.

In general, any image file format that stores the pixel data
in binary at the end of the file are suitable to be read using
a MetaImage header.

You can create the MetaImage header by:

A) using the MetaImageImporter application available
    in InsightApplications/MetaImageImporter.

or


B) you can simply edit another MetaImage header using
    a basic text editor.


If you take option (B), assuming that your .vmr file is
called Lung.vmr, and dimensions 285 in X, 335 in Y,
  and 150 in Z, the MetaImageHeader will look like:


------- beginning of file ----------------

ObjectType = Image
NDims = 3
BinaryData = True
BinaryDataByteOrderMSB = False
ElementSpacing = 1.0 1.0 1.0
DimSize = 285 335 150
ElementType = MET_UCHAR
HeaderSize = -1
ElementDataFile = Lung.vmr

------- end of file ----------------

The HeaderSize=-1 is quite important here, it will instruct the
MetaImage reader to skip the header of the vmr file and just take
the data at the end of the file.

The only concern is that this files seem to lack the information
about pixel spacing and origin. They probably are associated to
other files providing such information. Note that using images
lacking pixels spacing information makes your applications quite
unsafe.  You will have to recover the real pixel spacing information
from some source parallel to the VMR file. Leaving the default
values of 1.0, 1.0, 1.0 mm will be dangerous in a real medical
application.



Regards,



   Luis


-------------------------
marcellus walace wrote:
...
 > But
> the problem is that I don't know if  itk can visualize vmr files. I 
> can't program an vmr myself
> cause I'm here for only a month I don't have time. Do you Have a 
> suggestion about vmr?
> 
> 
>> From: Luis Ibanez <luis . ibanez at kitware . com>
>> To: marcellus walace <marcelluswalace at hotmail . com>
>> CC: ITK <Insight-users at public . kitware . com>
>> Subject: Re: ITK Processing + VTK Visualization
>> Date: Thu, 31 Jul 2003 08:40:12 -0400
>>
>>
>> Hi Marcellus,
>>
>> ITK does not provide any visualization functionality.
>> The goal of ITK is to perform image Segmentation and
>> Registration.
>>
>> You may use VTK for visualizing the image, in particular
>> using the vtkImageViewer class.
>> http://www . vtk . org/doc/nightly/html/classvtkImageViewer . html
>>
>> If what you want is to load a BMP file into ITK and do
>> image processing with it, you may use the vtkBMPReader
>> and then the VTKImageToImage adaptor in order to convert
>> the vtkImageData object into and itkImage.
>>
>> Note that BMP is a poor format for storing medical images,
>> in particular its mechanism form storing pixel spacing is
>> quite unprecise since it uses an integer to store the
>> number of pixels per meter. That is one of the reaons why
>> BMP readers are absent in ITK. Another reason is that BMP
>> is mostly used by MS-Windows applications and not that much
>> by Unix applications.
>>
>> If you feel like writing a BMP reader, you may want to look
>> at converting the code for writing BMPs posted on the list
>> http://www . itk . org/pipermail/insight-users/2003-June/003952 . html
>>
>>
>>
>>   Regards,
>>
>>
>>     Luis
>>
>>
>>
>> -------------------------------
>> marcellus walace wrote:
>>
>>>
>>>
>>> Hi Luis,
>>>
>>> I have one another question.
>>> But How can I visualize BMP file in itk?
>>>
>>> Regards
>>>
>>> _________________________________________________________________
>>> The new MSN 8: advanced junk mail protection and 2 months FREE* 
>>> http://join . msn . com/?page=features/junkmail
>>>
>>>
>>
>>
>>
> 
> _________________________________________________________________
> Add photos to your e-mail with MSN 8. Get 2 months FREE*. 
> http://join . msn . com/?page=features/featuredemail
> 
>