Hi Lucia, one way of doing this is to import the vti in Paraview, run "Clean to grid" so that you have it converted to a vtkUnstructuredGrid, and then apply the transformation. Unfortunately the memory consumption will be sub-optimal, but you should be able to do this.
The main difficulty related to applying the MRI header directions directly is that you know the directions, but you don't know if the pixels were laid out in the same order and the origin is in the correct "corner", especially if you converted images from MR to tiff - pixels might have been reordered in the process. Since you are asking, I guess there's no way for you to read images directly from the original dicom files, right? One other bit of information: 3DSlicer (www.slicer.org) supports oriented images natively and it includes a transformation editor (so that you can change the numbers and you see the image relocating itself in real time) so you may want to give it a shot. Ciao! Luca On Mar 2, 2012, at 3:36 PM, Lucia Mirabella wrote: > Thank you! > > The very elegant solution did the trick! :-) > > FYI I also tried -useitk 0 but it creates a vti only with one image instead > of the stack. Probably I should specify the pattern instead of using -ifile, > but I am having the problem with the file name pattern. Anyway, modifying the > vti works fine! > > I have another question: is it possible to apply a transformation to a vti? > The goal would be to display it in e.g. Paraview in the physical space, given > by the MRI header. So I don't want to reslice it, just to basically rotate > and translate it on the bases of a transformation matrix. > > Thanks! > > Lucia > > > On Mar 2, 2012, at 8:48 AM, Luca Antiga wrote: > >> Hi Lucia, >> the (admittedly obscure) reason why the spacing is ignored is that by >> default vmtk uses the ITK I/O factories to read images, while some of the >> options >> are used in case you use >> -useitk 0 >> This should fix it. >> >> On the other hand, you can (very elegantly) open the vti file with a text >> editor, change the spacing and save :-) >> >> On my hand, I'll try to come up with a better way of enforcing the spacing >> even when one uses the default -useitk 1 option. >> >> Best regards >> >> >> Luca >> >> >> On Mar 2, 2012, at 2:41 PM, Lucia Mirabella wrote: >> >>> Hi Luca, hi all, >>> >>> I'm trying to build a vti from a set of tiff images. Since the slice >>> thickness is different from the in-plane resolution, I would like to set >>> the correct spacing. I tried with >>> >>> vmtkimagereader -f tiff -ofile image_volume.vti -ifile Segmented_00.tiff >>> -spacing 1.5625 1.5625 10 >>> >>> However image_volume.vti has the default spacing 1 1 1. >>> >>> I also tried using >>> >>> vmtkimagereader -f tiff -ofile image_volume.vti -d ./prova/ -spacing 1.5625 >>> 1.5625 10 -prefix Segmented_ -pattern %s%02d.tiff >>> >>> but I get this error >>> >>> Reading TIFF image file. >>> ERROR: In /Users/vmtk/tmp7/VTK/IO/vtkTIFFReader.cxx, line 324 >>> vtkTIFFReader (0x7407aa0): Unable to open file Segmented_-1.tiff >>> >>> So apparently it's looking for a file with a dash (instead of a 0) before >>> the number. >>> >>> Do you have an idea on what I am doing wrong? >>> >>> Thank you very much! >>> >>> Lucia >>> >>> >>> __________________________________________________ >>> >>> Postdoctoral Fellow, Cardiovascular Fluid Mechanics Laboratory >>> Wallace H. Coulter Department of Biomedical Engineering >>> Georgia Institute of Technology >>> 315 Ferst Drive NW, Parker H. Petit Biotechnology Building >>> Atlanta, GA 30332-0363 >>> E-mail: lucia.mirabe...@bme.gatech.edu >>> >>> >>> >>> ------------------------------------------------------------------------------ >>> Virtualization & Cloud Management Using Capacity Planning >>> Cloud computing makes use of virtualization - but cloud computing >>> also focuses on allowing computing to be delivered as a service. >>> http://www.accelacomm.com/jaw/sfnl/114/51521223/ >>> _______________________________________________ >>> vmtk-users mailing list >>> vmtk-users@lists.sourceforge.net >>> https://lists.sourceforge.net/lists/listinfo/vmtk-users >> > > __________________________________________________ > > Postdoctoral Fellow, Cardiovascular Fluid Mechanics Laboratory > Wallace H. Coulter Department of Biomedical Engineering > Georgia Institute of Technology > 315 Ferst Drive NW, Parker H. Petit Biotechnology Building > Atlanta, GA 30332-0363 > E-mail: lucia.mirabe...@bme.gatech.edu > > ------------------------------------------------------------------------------ Virtualization & Cloud Management Using Capacity Planning Cloud computing makes use of virtualization - but cloud computing also focuses on allowing computing to be delivered as a service. http://www.accelacomm.com/jaw/sfnl/114/51521223/ _______________________________________________ vmtk-users mailing list vmtk-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/vmtk-users