[vtkusers] vtkImageReslice

David Gobbi dgobbi at irus.rri.on.ca
Sun Mar 4 14:22:50 EST 2001


Hi Amit,

If you can send me a complete, compilable C program and a small
example image that would help a great deal.  

>From the piece of you sent, here is one possible problem:
Whenever you use vtkImageReslice, you should make sure you set
the following appropriately.

    reslice->SetOutputExtent()
    reslice->SetOutputSpacing()
    reslice->SetOutputOrigin()

I recall mentioning this to you in an earlier email.  I repeat,
this is _very_ important.  Don't trust vtkImageReslice to set
up sensible defaults for these parameters.

If you want to rewite the transformed image back into the original
vtkImageData, then you might actually want to hold the image in
your own C++ array instead of in VTK's memory, and use 
vtkImageImport and vtkImageExport to move the data back and forth
between your array and the VTK pipeline.  

 - David

--
  David Gobbi, MSc                    dgobbi at irus.rri.on.ca
  Advanced Imaging Research Group
  Robarts Research Institute, University of Western Ontario

On Sun, 4 Mar 2001, [iso-8859-1] amit saxena wrote:

> Hi David,
> 	Some time back I had sent a query about ImageReslice
> class. The problem was that although the class was
> working in unix but when it comes to windows it just
> gives a blank and the application just hangs. 
>         At that time after looking at the code you
> suggested me to download the vtk again. I did it and
> the problem is still same. The class doesnot seem to
> be working at all. 
>         I am in a fix because of that problem. I am
> sending you the code along. If there is some bug in
> vtkImageReslice, then how can we rewrite the image
> back to the ImageData class after transforming the
> image data directly?
> 
>          I am sending the piece of code along :
> 
>        vtkVolume16Reader *reader1 =
> tkVolume16Reader::New();
>          reader1->SetFilePrefix(fileName1[0]);
>   reader1->SetHeaderSize(header[0]);
>   if (byteSwap)
>    reader1->SwapBytesOn();
>   reader1->SetImageRange(range[0][0],range[0][1]);
>   reader1->SetDataSpacing(space[0][0], space[0][1],
> space[0][2]);
>          reader1->SetDataDimensions(height[0],
> width[0]);
>            vtkImageShrink3D *shrink2 =
> vtkImageShrink3D::New();
>           shrink2->SetInput(reader1->GetOutput());
>           shrink2->SetShrinkFactors(1,
> 
> 1,1.0*(range[0][1]-range[0][0])/(range[1][1]-range[1][0])
> );
> 
>          vtkImageReslice *reslice1 =
> vtkImageReslice::New();
>           reslice1->SetInput(reader1->GetOutput());
>           reslice1->SetOutputSpacing(1,1,1);
>           reslice1->InterpolateOn();
>          reslice1->SetInterpolationModeToCubic();
>          reslice1->SetResliceTransform(transform);
> 
>        vtkImageViewer *viewer1 =
> vtkImageViewer::New();
>         viewer1->SetInput(reslice1->GetOutput());
>         viewer1->SetColorLevel(1000);
>         viewer1->SetZSlice(0);
> 
> Waiting eagerly for the reply
> 
> Amit
> 
>  	
>  
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Mail – Free email you can access from anywhere!
> http://mail.yahoo.com.sg/
> 
> _______________________________________________
> 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://public.kitware.com/mailman/listinfo/vtkusers
> 





More information about the vtkusers mailing list