AW: [vtkusers] How to realize volume raycast?

Chunyan Jiang jiang at TI.FhG.DE
Fri Oct 25 09:47:37 EDT 2002


Hi, Andrew,
Thank you for your help. It will be helpful if I want to shift data type
some time. Now my problem is not data type. I imported short int data to
vtkImageImport. Since I must do some operation on data, I have to import
them from array to vtk pointer, instead of using vtk reader.
Now it can be shown by vtkDataSetMapper. However, it can not be shown by
vtkVolumeRayCastMapper. How can I solve this problem?
By the way, the output of vtkImageImport is vtkImageData, not
vtkStructuredPoints.

Best,

Chuyan

-----Ursprungliche Nachricht-----
Von: Andrew Porter [mailto:Andrew.R.Porter at man.ac.uk]
Gesendet: Donnerstag, 24. Oktober 2002 18:49
An: Chunyan Jiang
Betreff: Re: [vtkusers] How to realize volume raycast?


Hi Chunyan,

The volume renderer will only deal with byte data.  If you have anything
else (eg floats) then you have to filter them first:

  vtkStructuredPoints* structPts = reader->GetOutput();

  structPts->GetScalarRange(range);
  printf("Input field range: min = %.3f, max = %.3f\n",range[0],range[1]);

  // Convert to byte data because that's what the vol. renderer needs
  vtkImageShiftScale *imageShift = vtkImageShiftScale::New();
  imageShift->SetShift(-range[0]);
  imageShift->SetScale(255.0/(range[1]-range[0]));
  imageShift->SetOutputScalarTypeToUnsignedChar();
  imageShift->SetInput(structPts);

and you'll be needing a

imageShift->GetOutput()

too.

Hope this helps.

Andrew.




> Dear VTK users,
> I import 3d image data to vtkImageImport. Now I want to realize volume
> rendering. So I use the example SimpleRayCast and add the vtkImageImport
to
> the line:
> volumeMapper->SetInput(importer->GetOutput());
> instead of
> volumeMapper->SetInput(reader->GetOutput());
>
> But the data can not be displayed on the screen. How should I do?
> Thanks in advance!
>
> Chunyan
>
> ***********************************************************************
> Chunyan Jiang, Dipl.-Inform.,
> Institut for Telematic
> Bahnhofstrasse 30-32, D-54292 Trier, Germany
> Phone: (+49) (0)651-97551-34
> Fax: (+49) (0)651-97551-12
> ***********************************************************************
>
> _______________________________________________
> 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
>


--
Andrew Porter

Software engineer, RealityGrid      Tel. :  +44 (0)161 2757184
Manchester Computing                Fax. :  +44 (0)161 2756040
University of Manchester            Email:  Andrew.Porter at man.ac.uk
Oxford Road                         Web  :  www.realitygrid.org
Manchester, M13 9PL                      :  www.csar.cfs.ac.uk/staff/porter/





More information about the vtkusers mailing list