[vtkusers] Re: orthogonal slices through a volume

David Gobbi dgobbi at atamai.com
Tue Aug 22 09:31:47 EDT 2006


Anja Ende wrote:
> Hi David,
>
> You were right on the money with setting the output dimension to 2 for 
> the reslicer!! Thanks a bunch for that. I have one final query and I 
> am wondering if you can help me with it. I am pretty sure this might 
> have something to do with the output spacing but am unable to figure 
> this one out....
>
> Now, I have set the reslicer to the normal XY plane and I am trying to 
> navigate through the Z slices with
>
> m_reslicer1->SetResliceAxesOrig
> in(0,0,value);
>
> where value is the index of the Z slice that I want to see.
>
> Now my data set has 100 slices, so the value could be between 0 and 
> 99. However, after the reslicing the dataset is only 40 slices now... 
> I am playing around with the output extent but has not helped so far.
>
> If you have any ideas, I would really appreciate some input.

The trick here is that the point (x,y,z) for SetResliceAxesOrigin(x,y,z) 
is an actual coordinate in data space.  It isn't a set of three indices.

So if you want to get slice "i" you need to calculate "z" by using the 
origin and spacing of the data that you input to vtkImageReslice:

  vtkImageData *imageData = slicer->GetInput();
  imageData->UpdateInformation();
  double origin[3];
  double spacing[3];
  imageData->GetOrigin(origin);
  imageData->GetSpacing(spacing);

  z = origin[2] + i*spacing[2];

Let me know if this fixes your problem. 

 - David



More information about the vtkusers mailing list