[vtkusers] regarding thinplatspline

S, Sripriya (MED) SripriyaS at geind.ge.com
Mon Feb 4 08:11:56 EST 2002


hi all,
> >
> > i am using vtkThinPlateSplineTransform for image registration. i have
> > manually calculated the landmark points pair and i set it in the
vtkpoints
> > p1 and p2. i am enclosing the source code of the program along with this
> > mail. am i using the classes properly? i read one image and try to
> transform
> > it using thin plate spline transform. i dont get any output at all. its
a
> > blank image. can u tell me where i am wrong??? the source code is in
java
>  i got this piece of code from the
> > following hyperlink.
> >
> >
>
http://www.cs.utah.edu/~cs5630/vtk/tcl/contrib/examplesTcl/html/TestWarpResl
> > iceGrid.tcl.html
> >
> > i dont know where i am wrong and why i dont get any output at all.
> >
> > thanks in advance.
> > regards
> > priya
> >
> > public class vtkThinImage
> > {
> >   public vtkThinImage()
> >   {
> >       Frame f;
> >       vtkPanel panel;
> >       f=new Frame();
> >       f.addNotify();
> >
> >       panel=new vtkPanel();
> >       panel.setSize(256,256);
> >       f.add(panel);
> >
> >       vtkVolume16Reader reader=new vtkVolume16Reader();
> >       reader.SetFilePrefix("f:\\test images\\t1");
> >       reader.SetHeaderSize(0);
> >       reader.SetDataDimensions(256,256);
> >       reader.SetImageRange(1,1);
> >       reader.SetDataByteOrderToBigEndian();
> >
> >       vtkPoints p1=new vtkPoints();
> >       vtkPoints p2=new vtkPoints();
> >       p1.InsertNextPoint(86, 94, 1);
> >       p2.InsertNextPoint(79, 100, 1);
> >
> >       p1.InsertNextPoint(164, 96, 1);
> >       p2.InsertNextPoint(153, 89, 1);
> >
> >       p1.InsertNextPoint(92, 132, 1);
> >       p2.InsertNextPoint(94, 140, 1);
> >
> >       p1.InsertNextPoint(144, 158, 1);
> >       p2.InsertNextPoint(149, 154, 1);
> >
> >       p1.InsertNextPoint(131, 117, 1);
> >       p2.InsertNextPoint(127, 115, 1);
> >
> >
> >       vtkThinPlateSplineTransform transform=new
> > vtkThinPlateSplineTransform();
> >       transform.SetSourceLandmarks(p1);
> >       transform.SetTargetLandmarks(p2);
> >       //transform.SetBasisToR();
> >       transform.SetBasisToR2LogR();
> >
> >       vtkTransformToGrid gridThinPlate=new vtkTransformToGrid();
> >       gridThinPlate.SetInput(transform);
> >       //gridThinPlate.SetGridExtent(0, 64, 0, 64, 1, 93);
> >       //gridThinPlate.SetGridSpacing(4.0, 4.0, 2.0);
> >       //gridThinPlate.SetGridOrigin(-128, -128, -94);
> >       //gridThinPlate.SetGridScalarTypeToUnsignedChar();
> >
> >       vtkGridTransform gridTransform=new vtkGridTransform();
> >       gridTransform.SetDisplacementGrid(gridThinPlate.GetOutput());
> >
> >
gridTransform.SetDisplacementShift(gridThinPlate.GetDisplacementShift());
> >
> >
gridTransform.SetDisplacementScale(gridThinPlate.GetDisplacementScale());
> >
> >       vtkImageReslice reslice=new vtkImageReslice();
> >       reslice.SetInput(reader.GetOutput());
> >       reslice.SetResliceTransform(gridTransform);
> >       reslice.SetInterpolationModeToLinear();
> >
> >       vtkImageViewer viewer=new vtkImageViewer();
> >       viewer.SetInput(reslice.GetOutput());
> >       viewer.SetZSlice(0);
> >       viewer.SetColorWindow(2000);
> >       viewer.SetColorLevel(1000);
> >       viewer.Render();
> >   }
> >   public static void main(String str[])
> >   {
> >      new vtkThinImage();
> >   }
> > }

thanks.
priya


"THIS E-MAIL MESSAGE ALONG WITH ANY ATTACHMENTS IS INTENDED ONLY FOR THE
ADDRESSEE and may contain confidential and privileged information.
If the reader of this message is not the intended recipient,
you are notified that any dissemination, distribution or copy of this 
communication is strictly Prohibited. 
If you have received this message by error, please notify us 
immediately, return the original mail to the sender and delete the 
message from your system."




More information about the vtkusers mailing list