[vtkusers] create a vtkImageData from scratch

P B chose29 at hotmail.com
Mon Aug 4 15:18:23 EDT 2008


Hi,
 
   I answered my previous question in part since I managed to create a vtkImageData from scratch by using the following:
 
MRI->SetDimensions(...etc...);
MRI->SetScalarTypeToUnsignedShort();
MRI->SetNumberOfScalarComponents(1); // image holds one value intensities
MRI->SetSpacing(...etc...);
MRI->SetOrigin(...etc...);
MRI->AllocateScalars(); // allocate storage for image data
 
unsigned short * VolPtr = (unsigned short *) MRI->GetScalarPointer();
for( i=0; i<Dim0*Dim1*Dim2; i++ )
{
          *VolPtr= ...etc...;
          *VolPtr++;
}
 
 
 
But I have a question:  how do I set the orientation of the volume? The MRI data originally has a certain orientation given by a model matrix. Do I have to apply this orientation as a transformation to vtkImageData or is there another option to set that I did not find?
 
Thank you in advance for your help, I am still new to vtk and if someone could hint me in the right direction that would help me a lot!
 
Pascale
 
 
 



From: chose29 at hotmail.comTo: vtkusers at vtk.orgDate: Sat, 2 Aug 2008 09:29:27 -0400Subject: [vtkusers] create a vtkImageData from scratch


Hi everyone,    I am trying to create a VTK imageData from scratch. I currently have a volume in an inhouse format. I have all the information to create a new volume (voxel intensities, dimensions, spacing, origin, model matrix) but do not know what to use to transform it to vtk. The volume went through a series of transformation and the model matrix is important. How can I create a vtk volume with the same orientation, intensities, etc..? I've searched in the archives of the vtk mailing list and found nothing that could help. If someone has an example that would be very helpfull, Thanks in advance!Pascale



_________________________________________________________________
Find hidden words, unscramble celebrity names, or try the ultimate crossword puzzle with Live Search Games. Play now!
http://g.msn.ca/ca55/212
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20080804/97e763aa/attachment.htm>


More information about the vtkusers mailing list