[vtkusers] vtkImageReslice produce wrong output dimension?

David Gobbi david.gobbi at gmail.com
Fri May 31 13:48:10 EDT 2013


When you feed a 128x128x2 image into vtkImageActor, it displays it
with a size of 127x127x1.  It cuts off the outer half of every edge
pixel.

Try calling actor->GetMapper()->BorderOn() to see if this fixes the
problem.

 - David

On Fri, May 31, 2013 at 11:10 AM, TrackVis Admin <trackvis at gmail.com> wrote:
> Hi all,
>
> I've been trying to use vtkImageReslice to display a 3D image volume as
> image slice. Here is what I did:
>
>     vtkImageReslice* reslice = vtkImageReslice::New();
>     reslice->SetInput( image_data );
>     reslice->BorderOn();
>     reslice->AutoCropOutputOn();
>
>     // This sets us to extract slices.
>     reslice->SetOutputDimensionality( 2 );
>
>     // This will change depending what orienation we're in.
>     reslice->SetResliceAxesDirectionCosines( 1, 0, 0,
>         0, 1, 0,
>         0, 0, 1 );
>
>     // Image to colors using color table.
>     vtkImageMapToColors* colormap = vtkImageMapToColors::New();
>     colormap->SetLookupTable( some_lookup_table );
>     colormap->SetInputConnection( reslice->GetOutputPort() );
>
>     vtkImageActor* actor = vtkImageActor::New();
>     actor->SetInput( colormap->GetOutput() );
>
> Everything appears to be fine until I applied it on a single slice volume.
> For example, if the input volume has dimension of 128x128x1. I would expect
> it show a thin line on X or Y plane with dimension of 128x1. However, I see
> nothing! If I use a volume of 128x128x2, I only see 1 line of pixels on X or
> Y plane, where I expect to see 2 lines (128 x 2). Did I do anything wrong?
> Why does it look like that 1 slice of the data is missing?
>
> Thank you!
> RP



More information about the vtkusers mailing list