[vtkusers] Coordinates of VTKImagereslice
N.E. Mackenzie Mackay
9nem at qlink.queensu.ca
Sun Jun 20 09:19:05 EDT 2004
Hey david,
I was wondering how do I place in the correct 3D location once I have
it. What I have right now is my vtkPlaneSource defiend by a origin and
two points and a image returned by vtkImage reslice using those same
parameters as the Axes Directional Cosiness for the reslice ( the code
you provided, thank you :) ) What I want to do is place the image
returned from the reslice onto that plane.
As of right now the reslice itself is way bigger then the plane I used
to define it ( size of the volume it passes). I have been trying to
mess with the output extent to limit the reslice to the dimensions of
the plane. This it doesn't seem to give the correct results. The
image returned with the output extent specified isn't the desired
image. The image seems to be cropping itself in the middle, rather
then around the origin.
My question then is ( open to anyones input ):
How do you place a image produced by vtkImageReslice on a plane with
bounds smaller then the volume in a 3d scene?
Thanks again so much for all the help,
Neilson
On May 27, 2004, at 11:28 AM, David Gobbi wrote:
> Hi Neilson,
>
> I'll try to answer your questions. See below.
>
> On Thu, 27 May 2004, N.E. Mackenzie Mackay wrote:
>
>> Hi,
>>
>> I am trying to cut through a 3D volume along a certain 2D plane. I am
>> having a problem defining the cosines and origin for vtkImageReslice.
>>
>> Right now I have a origin, normal and two points on the plane in world
>> cordinates. I almost positive these points are correct. When I use
>> these values for image reslice I do not end up with the correct slice:
>>
>> vtkImageReslice *slicer = vtkImageReslice::New();
>> slicer->SetInput(v16->GetOutput()); // volume
>> slicer->setResliceAxesDirectionCosines(point1, point2, normal);
>> slicer->SetResliceAxesOrigin(origin);
>> slicer->SetOutputDimensionality(2);
>
> The direction cosines are vectors, so you should define v1, v2 as
> follows:
> v1[0] = point1[0] - origin[0]; etc. for v1[1], v1[2]
> v2[0] = point2[0] - origin[0]; etc. for v2[1], v2[2]
> vtkMath::Normalize(v1);
> vtkMath::Normalize(v2);
>
> slicer->setResliceAxesDirectionCosines(v1, v2, normal);
>
> This assumes that origin, point1, and point2 correspond to the same
> values you would use to set up a vtkPlaneSource that represents your
> plane.
>
>> I tried multiplying point1, point2, normal and origin by the spacing
>> for the volume to try and put them in the same space but still no
>> positive results. I Guess my question is:
>>
>> 1. What is the coordinate frame vtkImageReslice works in?
>
> In VTK terms, it works in the "data" coordinate system according
> to the Origin and Spacing of the data. It does not work in the i,j,k
> voxel-index coordinate system, which is often referred to as
> "structured" coords.
>
>> 2. How does the direction cosines effect the slice that is being cut?
>> Eg. I am taking a 2d slice of a volume. If I provided
>> the identity
>> matrix for the cosines and origin to vtkImageReslice what axis would
>> the resulting reslice plane lie on( XY, YZ, XZ ect.) I assume it's
>> the
>> XY plane but I am not sure.
>
> The XY plane.
>
>> 3. Does anyone have some sample code for setting a reslice of a
>> specific 2d plane ( defined by a normal, 2 points and a origin)
>> through a 3d volume?
>
> You can take a look at the source code for vtkImagePlaneWidget in the
> Hybrid directory.
>
> - David
>
>> If anyone who has some insight on this could please help me out I
>> would
>> be in there debt. This problem has stupped me for quite some time and
>> is a big road block.
>>
>> Thanks you so much in advance,
>> Neilson
>>
>>
>> _______________________________________________
>> This is the private VTK discussion list.
>> Please keep messages on-topic. Check the FAQ at:
>> <http://public.kitware.com/cgi-bin/vtkfaq>
>> Follow this link to subscribe/unsubscribe:
>> http://www.vtk.org/mailman/listinfo/vtkusers
>>
>
More information about the vtkusers
mailing list