[vtkusers] How to set visualization network?

yoshihiko_nagamine at pis.hitachi.co.jp yoshihiko_nagamine at pis.hitachi.co.jp
Mon Jun 3 07:06:59 EDT 2002


Hi All

Now, I have been developed medical image viewer for my reserch purpose.
I use VTK 3.2 and Java

In my test application, I define ImageData Class like this:
In this ImgData class, I set ImageData (orgData) from vtkScalars.

and then, I call Render class.
In the Render class, the RenderCreate() function is a core function.
It processes the visualization network.

When run this sample application, the vtkContourFilter complaines,
"No Input!"

Does anybody knows the way to pass the vtkImageData to vtkContourFilter or
How to start the visualization network ?

Thanks in advance.

=========Image Data Class============
public class ImgData{

     static { System.loadLibrary("vtkJava"); }

     private vtkImageReader imgRdr;
     private vtkImageData   orgData;
     vtkScalars scalars = new vtkScalars();

     ImgDate()
     {
          imgRdr  = new vtkImageReader();
          orgData = new vtkImageData();
     }

     private void SetImageReader()
     {
          imgRdr.SetDataByteOrderToLittleEndian();
          imgRdr.SetDataExtent(0,63,0,63,1,90);
          imgRdr.SetFilePrefix(".\\headsq\\quarter");
          imgRdr.SetDataMask(0x7fff);
          imgRdr.SetDataSpacing(3.2, 3.2, 1.5);
          imgRdr.Update();
     }

     void SetImageData()
     {
          SetImageReader(); // a proxy reader for No VTK-LIKE image reader
                                                  // in a feature, accesser
to file server will use
          scalars.SetDataTypeToInt();
          scalars = imgRdr.GetOutput().GetPointData().GetScalars();
          orgData.SetDimensions(64,64,90);
          orgData.SetSpacing(3.2,3.2,1.5);
          orgData.SetNumberOfScalarComponents(1);
          orgData.GetPointData().SetScalars(scalars);
     }

     private vtkImageReader GetReader()
     {  return imgRdr; }

     vtkImageData GetOutput()
     { return orgData; }
}
==================================

===============vtkRender Class=========
public class vtkRender {
            ImgData pat;

            ------ snip ------

            vtkRender(ImgData _pat)
            { pat = _pat; }

            ------ snip -------

     vtkRenderer RenderCreate()
     {
          // *** Extract Value ***
                       //--------------------------
                       // volExt is a vtkCounterFilter
                       //--------------------------
          volExt.SetInput(pat.GetOutput());
          volExt.UseScalarTreeOn();
          volExt.SetValue(minCT, maxCT);

          // *** Mapping ***
          polyMap.SetInput(volExt.GetOutput());
          polyMap.ScalarVisibilityOff();

          // *** Actor ***
          actor.SetMapper(polyMap);

          light.SetIntensity(0.0);
          renderer.AddLight(light);

          // *** Renderer ***
          renderer.AddProp(actor);

          return renderer;
     }
}
========================================
----------------------------------------
Yoshihiko Nagamine




More information about the vtkusers mailing list