[vtkusers] reslice problem

David Gobbi dgobbi at imaging.robarts.ca
Tue Feb 4 10:04:06 EST 2003


Hi Matei,

You have given a z spacing of 0.0 to the reader:

noduleReader->SetDataSpacing(1,1,0.0);

You should instead set the z spacing to the distance from the
centre of one slice to the centre of the next slice.

Cheers,
  - David

-- 
  David Gobbi, MSc                dgobbi at imaging.robarts.ca
  Advanced Imaging Research Group
  Robarts Research Institute, University of Western Ontario

On Tue, 4 Feb 2003, Matei MANCAS wrote:

> Hi all!!!
>
> I use vtkImageReslice to change the view on a set of 348 slices in order to get coronal or sagital views...
> My code is :
>
> vtkRenderer *renderer;
> vtkTIFFReader *noduleReader;
> vtkImageMapper *noduleMapper;
> vtkImageActor *noduleActor;
> noduleReader = vtkTIFFReader::New();
> noduleMapper = vtkImageMapper::New();
> renderer = vtkRenderer::New();
> noduleActor = vtkImageActor::New();
>
>
> noduleMapper->SetColorWindow(255.0); // Width -- We are working in 8 bits...
> noduleMapper->SetColorLevel(255.0/2); // Center
>
> noduleReader->SetFilePrefix("..........");
>
> noduleReader->SetFilePattern("%s%.4d.tif");
> noduleReader->SetFileNameSliceOffset(1);
> noduleReader->SetDataExtent(0,511,0,511,0,347);
> noduleReader->SetDataSpacing(1,1,0.0);
>
>
>     // reslice
>
> vtkImageReslice *reslice = vtkImageReslice::New();
> reslice->SetInput(noduleReader->GetOutput());
>
> reslice->SetResliceAxesDirectionCosines(1,0,0, 0,0,1, 0,1,0); // exchange y and z
> reslice->SetOutputSpacing(1, 1, 1);
> reslice->SetOutputExtent(0,511,0,511,0,347);
>
> noduleActor->SetInput(reslice->GetOutput());
> noduleActor->SetDisplayExtent(0,511,0,511,0,347);
> noduleActor->SetZSlice(300);
>
> renderer->AddActor(noduleActor);
>
>
> It works well (I get the 300th slice when I don't use reslice) but I have a black screen using reslice->SetResliceAxesDirectionCosines(1,0,0, 0,0,1, 0,1,0); for exchanging y and z axes. I would want to see all my slices but
>
> It is possible that it is due to the camera which has no more a view on the new object...
>
> Can anyone help me please?????
>
> Thanks
>
> Matei
>




More information about the vtkusers mailing list