[vtkusers] Is there a method by which you can impose on each other vtkImageData for vtkImageViewer?

Андрей Глухов realandron at gmail.com
Mon Mar 22 08:15:02 EDT 2010


Hi,
Is there a method by which you can impose on each other vtkImageData (the
first layer is a DICOM slice, the second is my own array of points) for
vtkImageViewer?
For vtkRenderer I create two actor's for the top sets the transparency. And
for viewer I see only second array.
//Code
            vtkDICOMImageReader DicomReader = new vtkDICOMImageReader();
            DicomReader.SetFileName(@"");
            DicomReader.Update();
            vtkImageData vol = new vtkImageData();
            vol.SetDimensions(512, 512, 2);
            vol.SetSpacing(1, 1, 1);
            vol.SetOrigin(0, 0, 0);
            vol.SetScalarTypeToUnsignedChar();
            vol.SetNumberOfScalarComponents(3);
            vol.AllocateScalars();
            for (int i = 0; i < 512; i++)
            {
                for (int j = 0; j < 512; j++)
                {
                    vol.SetScalarComponentFromFloat(i, j, 0, 0,
(float)vtkMath.Random(0,255));
                    vol.SetScalarComponentFromFloat(i, j, 0, 1, 0);
                    vol.SetScalarComponentFromFloat(i, j, 0, 2, 0);
                }
            }
            vtkImageViewer viewer = new vtkImageViewer();
            viewer.SetInputConnection(DicomReader.GetOutputPort());
            viewer.SetInput(vol);//On the Screen
            viewer.SetSize(512, 512);
            viewer.SetColorWindow(1000);
            viewer.SetColorLevel(1);
            viewer.Render();
-- 
С Уважением,
Андрей.
Best regards, Andrew
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100322/f0c04f78/attachment.htm>


More information about the vtkusers mailing list