[vtkusers] render color volume

jalal sadeghi jalal.sadeghy at gmail.com
Sun Jun 28 03:38:23 EDT 2009


On Sun, Jun 28, 2009 at 7:59 AM, <enjoywm at cs.wm.edu> wrote:

> Hi,
> I want to render a color volume with 4 components: RGBA.
> I want to use component alpha instead of opacity mapping function to
> control the opacity. Can I do this?
>
> Thanks for help.
>
> Yixun
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>


This Was my qeuestion about a week age and I used this Soloution:
Filling an Image with 4 component r g b and alpha (value between 0 255)


vtkImageData*  pImage=vtkImageData::New();
pImage->SetDimensions(512,512,1);
pImage->SetScalarTypeToUnsignedChar();
pImage->SetNumberOfScalarComponents(4);
pImage->AllocateScalars();

and
a For filling it a code like this
ptr=(unsigned char*)pImage->GetScalarPointer();
while (i<count)
{

*ptr=0;ptr++;//red
         *ptr=120; ptr++; //green
         *ptr=0;ptr++;//blue
          *ptr=i%255;ptr++;//alpha


}
}


and I Used it as Texture for a plane
vtkTexture* pTex=vtkTexture::New();
pTex->SetInput(pImage);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20090628/6f26441d/attachment.htm>


More information about the vtkusers mailing list