Hi XiuJuan,
 welcome to vmtk. Sorry if it took this long to get an answer, we've been busy 
with the new release.

In order to read a raw image file, you have to manually specify all the 
information related to that raw volume. The reason is that a raw file only 
contains a long list of 0's and 1's, and it's up to you to instruct the reader 
about the data type, the dimensions and the spacing.

This is how you are supposed to invoke vmtkimagereader in your case

vmtkimagereader -ifile image.raw -f raw -spacing 0.363281011581 0.363281011581 
0.40000000596 -origin 0 0 0 -extent 0 511 0 511 0 271

If you also want to save it in mhd (and mha, nrrd, vti, nii, ...), 

vmtkimagereader -ifile image.raw -f raw -spacing 0.363281011581 0.363281011581 
0.40000000596 -origin 0 0 0 -extent 0 511 0 511 0 271 -ofile outputImage.mhd


Just so you know, vmtk can also read mhd directly:

vmtkimagereader -ifile image.mhd

also in other scripts than vmtkimagereader, e.g.

vmtkimageviewer -ifile image.mhd


Hope this helps


Luca


On Apr 24, 2012, at 9:44 AM, xiujuan wrote:

> Hi!
> I’m a new user of vmtk. So forgive my ignorance. But I have a problem when 
> using vmtkimagereader to load my own raw format data. When executing 
> vmtkimagereader in terminal, the results are shown as follows:
>        Executing vmtkimagereader ...
> Reading RAW image file.
> Spacing  (1.0, 1.0, 1.0)
> Origin  (0.0, 0.0, 0.0)
> Dimensions  (1, 1, 1)
> Done executing vmtkimagereader.
> Output vmtkimagereader members:
>        Id = 0
>        Image = vtkImageData
>        RasToIjkMatrixCoefficients = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 
> 0, 0, 1]
>        XyzToRasMatrixCoefficients = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 
> 0, 0, 1]
>  
> However, the corresponding .mhd file has shown the details of the raw data:
>  
>          NDims = 3
> DimSize = 512 512 272
> ElementType = MET_USHORT
> Offset = 4.91738319397e-007 4.91738319397e-007 0.0
> ElementSpacing = 0.363281011581 0.363281011581 0.40000000596
> ElementByteOrderMSB = False
> ElementDataFile = image00.raw
>  
> I have tried to type vmtk vmtkimagereader -f raw -ifile 
> /home/txj/toolkits/vmtk/data/image00.raw or vmtk vmtkimagereader -f raw 
> -ifile /home/txj/toolkits/vmtk/data/image00.raw -spacing 0.363281011581 
> 0.363281011581 0.40000000596 in the command line. The results are the same.
>  
> So I do not know what happened and how to do handle the problem. Look forward 
> your answer.
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and 
> threat landscape has changed and how IT managers can respond. Discussions 
> will include endpoint security, mobile security and the latest in malware 
> threats. 
> http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/_______________________________________________
> vmtk-users mailing list
> vmtk-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/vmtk-users

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
vmtk-users mailing list
vmtk-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/vmtk-users

Reply via email to