[vtkusers] Reslice

David Gobbi dgobbi at atamai.com
Thu Sep 22 16:46:36 EDT 2005


Hi Jim,

The transformation matrix works in world coordinates, where the world
coordinates are defined by the origin and spacinf of the ImageData.

The tranformation maps world coords of the Output image
to world coords  of the Input image.

 - David

James Carroll wrote:

>Thanks David,
>
>When I do the translations in the transformation matrix, what units are they in?
>
>My stack has an origin and a spacing set, so there is a mapping from
>real world coordinates to stack coordinates...
>
>Does vtkReslice transform transform things in the global 'world'
>coordinates, or relative to the extents of the stacks themselves?  You
>can see (below) that I've tried a few combinations...
>
>Thanks,
>-Jim
>
>
>
>    voiResample = vtkExtractVOI::New();
>    voiResample->SetInput(pipe);
>    int halfOutputSize = 16;
>
>    voiResample->SetVOI(centeredStackX - halfOutputSize,
>centeredStackX + halfOutputSize,
>                        centeredStackY - halfOutputSize,
>centeredStackY + halfOutputSize,
>                        centeredStackZ - halfOutputSize,
>centeredStackZ + halfOutputSize);
>
>    pipe = voiResample->GetOutput();
>
>    // The surface will always face the camera
>    vtkTransform *transform1 = vtkTransform::New();
>
>//    transform1->Translate(-halfOutputSize, -halfOutputSize, -halfOutputSize);
>//
>//    transform1->Translate(-m_pOGL->m_fModelCenterX,
>-m_pOGL->m_fModelCenterY, -m_pOGL->m_fModelCenterZ);
>    transform1->Translate(-centeredStackX, -centeredStackY, -centeredStackZ);
>    // rotate to face the camera
>    transform1->RotateX(m_pOGL->m_viewLattitude);
>    transform1->RotateY(m_pOGL->m_viewLongitude);
>
>//    transform1->Translate(halfOutputSize, halfOutputSize, halfOutputSize);
>
>//    transform1->Translate(m_pOGL->m_fModelCenterX,
>m_pOGL->m_fModelCenterY, m_pOGL->m_fModelCenterZ);
>    transform1->Translate(centeredStackX, centeredStackY, centeredStackZ);
>
>    // Get the bitmap out of the stack
>    vtkImageReslice *slicer = vtkImageReslice::New();
>    slicer->SetResliceTransform(transform1);
>    slicer->SetInput(pipe);
>    slicer->Update();
>    pipe = slicer->GetOutput();
>
>
>
>
>
>
>
>
>
>On 9/20/05, David Gobbi <dgobbi at atamai.com> wrote:
>  
>
>>Hi James,
>>
>>The easiest way to do this is to pass the image through
>>vtkImageChangeInformation,
>>and use vtkImageChangeInformation::CenterImageOn(), which will adjust the
>>coordinate system of your image so that (0,0,0) is at the center of the
>>stack.
>>
>>Once that has been done, you can use a pure rotation transform with
>>vtkImageReslice and the rotations will always be around the center.
>>
>>Using vtkImageChangeInformation isn't the only way to do this, but it is
>>probably the easiest.
>>
>>The other way (which is not as easy) is to create a reslice transform that
>>will do everything for you, i.e. it would have to translate, rotate, then
>>translate back again.
>>
>> - David
>>
>>James Carroll wrote:
>>
>>    
>>
>>>Hello,  I have an image stack, and am trying to resample a image out
>>>of the stack using vtkReslice.  I see that there are lots of powerful
>>>functions such as set Tranfromation matrix, and set origin, etc...
>>>but I am having trouble figuring out how to use them together.
>>>
>>>What I want to do is be able to specify:
>>>
>>>-  the size of the resulting image (it will be small relative to the
>>>extents of the stack)
>>>
>>>- the center of the resulting image in stack coordinates (world
>>>coordinates.)  This center is the location of the pixel that will
>>>change the least when the rotation angles change.
>>>
>>>- the angles that specify how the resulting image rotates around the
>>>Y axis of the source stack at the center point,  and then a second
>>>angle rotates the image around the image's local X axis at the
>>>resulting image's center point.
>>>
>>>How do I translate this center, angle, angle to the vtkReslice's
>>>SetOrigin and Set Transform commands?
>>>
>>>What this will let me do is have a plane that is always facing the
>>>viewer, that is texture mapped with the reslice image.  As I rotate
>>>the stack (orbit around it or examine it), the resulting image shows
>>>different resliced images.
>>>
>>>Thanks!
>>>-Jim
>>>_______________________________________________
>>>This is the private VTK discussion list.
>>>Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>>>Follow this link to subscribe/unsubscribe:
>>>http://www.vtk.org/mailman/listinfo/vtkusers
>>>
>>>
>>>
>>>      
>>>
>>    
>>
>
>  
>




More information about the vtkusers mailing list