[vtkusers] Re: how to access 3D volume

Divya Rathore divyaksr at iitk.ac.in
Wed Oct 5 02:56:52 EDT 2005


Dear Ravi,

It indeed is clear..
I am attaching the .cpp file for you to use.. There is a tcl example too with same name where you can access individual alice using a slider.
follow a comment in it for providing the data.

revert back in case of problems. You might have to comment a line or two here and there ..just a tweak not something of importance.

warm regards,
Divya Rathore
  ----- Original Message ----- 
  From: Ravi Samala 
  To: vtkusers at vtk.org 
  Sent: Wednesday, October 05, 2005 6:06 AM
  Subject: Re: [vtkusers] Re: how to access 3D volume


  hi Rathore,

  may be my question is not that clear, after loading the 3D volume from 2D slices using vtkVolume16Reader, I want to access individual slices to perform filtering operation (on a slice-by-slice basis).

  (Put it in other way, I need to extract a single slice from the 3Dvolume image (from the v16Img object) , -- how can I do that?)

  thank you,
  Ravi.


  Divya Rathore <divyaksr at iitk.ac.in> wrote:
    Search in the examples directory if you are using the source code of VTK.
    If you are using the binary (installable) version then also it is a matter of a simple file searching.

    Windows/Linux?
      ----- Original Message ----- 
      From: Ravi Samala 
      To: vtkusers at vtk.org 
      Sent: Tuesday, October 04, 2005 10:00 PM
      Subject: Re: [vtkusers] Re: how to access 3D volume


      hi Rathore,

      I am kind of new to VTK, can you tell me where can I find ImagePlaneWidget.cpp file.

      thank you,

      Ravi

      Divya Rathore <divyaksr at iitk.ac.in> wrote:
        Check out ImagePlaneWidget.cpp (I would like to thank Dr. Nagarajan, raman_nagarajan at vsnl.net, a member of this list).

        regards,
        D. Rathore
          ----- Original Message ----- 
          From: Ravi Samala 
          To: vtkusers at vtk.org 
          Sent: Monday, October 03, 2005 7:02 PM
          Subject: [vtkusers] how to access 3D volume


          hi vtkusers,

           I am reading 2D slices and constructing a 3D volume, using the following code....

          vtkVolume16Reader *v16Img = vtkVolume16Reader::New();

          v16Img->SetDataDimensions (sizex,sizey);

          v16Img->SetImageRange (atoi(argv[3]),atoi(argv[4])); 

          v16Img->SetHeaderSize(HeadS);

          v16Img->SetFilePrefix (argv[2]); 

          v16Img->SetDataSpacing (0.1, 0.1, 0.5);

          v16Img->SetDataOrigin(0, 0, 0);

          cout<<"Image Volume Read...."<<endl;




          //CompositeFunction with option

          vtkVolumeRayCastCompositeFunction *compositeFunction = vtkVolumeRayCastCompositeFunction::New();

          compositeFunction->SetCompositeMethodToInterpolateFirst(); 



          //Mapper with selected RayCastFunction

          vtkVolumeRayCastMapper *volumeMapper = vtkVolumeRayCastMapper::New();

          volumeMapper->SetInput(v16Img -> GetOutput());

          volumeMapper->SetVolumeRayCastFunction(compositeFunction);



          // Create transfer mapping scalar value to opacity

          vtkPiecewiseFunction *pieceFunc = vtkPiecewiseFunction::New();

          pieceFunc->AddPoint(0, 0.0); // alpha value for the lower intensity limit

          pieceFunc->AddPoint(15000, 0.5); // alpha value for the upper intensity limit



          //Set Volume Property

          vtkVolumeProperty *volumeProperty = vtkVolumeProperty::New();

          volumeProperty->SetInterpolationTypeToLinear();

          volumeProperty->SetScalarOpacity(pieceFunc);

          volumeProperty->ShadeOn();



          //The special actor with properties

          vtkVolume *vol = vtkVolume::New();

          vol->SetMapper(volumeMapper);

          vol->SetProperty(volumeProperty);



          // An outline provides context around the data.

          vtkOutlineFilter *outlineData = vtkOutlineFilter::New();

          outlineData->SetInput((vtkDataSet *) v16Img->GetOutput());

          vtkPolyDataMapper *mapOutline = vtkPolyDataMapper::New();

          mapOutline->SetInput(outlineData->GetOutput());

          vtkActor *outline = vtkActor::New();

          outline->SetMapper(mapOutline);

          outline->GetProperty()->SetColor(0,0,0); 




          //Starting to Render

          vtkRenderer *renderer=vtkRenderer::New();

          renderer->AddVolume(vol); 

          renderer->SetBackground(1,1,1);



          vtkRenderWindow *renWin=vtkRenderWindow::New();

          renWin->SetSize(500,500);

          renWin->DoubleBufferOn(); 

          renWin->AddRenderer(renderer);


          vtkRenderWindowInteractor *iren=vtkRenderWindowInteractor::New();

          iren->SetRenderWindow(renWin);

          iren->Initialize(); 

          iren->Start();



          my question is : is there any way I can access individual slices and a point in the 3 dimensional space (like p(x,y,z).



          thanks in advance,



          Ravi.



----------------------------------------------------------------------
          Yahoo! for Good
          Click here to donate to the Hurricane Katrina relief effort. 


----------------------------------------------------------------------


          _______________________________________________
          This is the private VTK discussion list. 
          Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
          Follow this link to subscribe/unsubscribe:
          http://www.vtk.org/mailman/listinfo/vtkusers

        _______________________________________________
        This is the private VTK discussion list. 
        Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
        Follow this link to subscribe/unsubscribe:
        http://www.vtk.org/mailman/listinfo/vtkusers



--------------------------------------------------------------------------
      Yahoo! for Good
      Click here to donate to the Hurricane Katrina relief effort. 


--------------------------------------------------------------------------


      _______________________________________________
      This is the private VTK discussion list. 
      Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
      Follow this link to subscribe/unsubscribe:
      http://www.vtk.org/mailman/listinfo/vtkusers

    _______________________________________________
    This is the private VTK discussion list. 
    Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
    Follow this link to subscribe/unsubscribe:
    http://www.vtk.org/mailman/listinfo/vtkusers



------------------------------------------------------------------------------
  Yahoo! for Good
  Click here to donate to the Hurricane Katrina relief effort. 


------------------------------------------------------------------------------


  _______________________________________________
  This is the private VTK discussion list. 
  Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
  Follow this link to subscribe/unsubscribe:
  http://www.vtk.org/mailman/listinfo/vtkusers
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20051005/124460fe/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ImagePlaneWidget.cxx
Type: application/octet-stream
Size: 20040 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20051005/124460fe/attachment.obj>


More information about the vtkusers mailing list