[vtkusers] Re: Re: Re: Creating a Volume from 2D BMP files.

Ashish Singh mrasingh at gmail.com
Mon Sep 18 10:35:28 EDT 2006


Thanks Yixun. I tried the few lines of code that you suggested to color the
volume. With the numerical values that you used my volume looks reddish pink
in color. I was wondering if anyone can tell me what the numerical values in
functions AddPoint and AddRGBPoint, mean. How do we choose what numerical
values to use? My volume is of the abdominal region, showing: the heart,
intestines, rib cage, kidneys etc. Can I use different colors or shades to
display each organ? How to do it?

Thanks,
Ashish

On 9/15/06, Yixun Liu <yxliu at fudan.edu.cn> wrote:
>
>  Hi,
> You can use  vtkPiecewiseFunction *tfun = vtkPiecewiseFunction::New() to
> show what you want to show and use vtkColorTransferFunction *ctfun =
> vtkColorTransferFunction::New() to color it. For example,
>
>
>
>  vtkPiecewiseFunction *tfun = vtkPiecewiseFunction::New();
>  vtkColorTransferFunction *ctfun = vtkColorTransferFunction::New();
>  vtkVolumeProperty *volumeProperty = vtkVolumeProperty::New();
> //the non-zero zone intepolate by the tfun will be shown
> tfun->AddPoint(100.0,0.0);
> tfun->AddPoint(200.0,1.0);
> tfun->AddPoint(500.0,1.0);
> tfun->AddPoint(510.0,0.0);
> //
> //color the volume accroding to the ctfun
> ctfun->AddRGBPoint(100.0,1.0,0.16,0.18);
> ctfun->AddRGBPoint(200.0,1.0,0.94,0.85);
> ctfun->AddRGBPoint(500.0,1.0,0.8,0.98);
> ctfun->AddRGBPoint(510.0,1.0,0.63,0.27);
>
>  volumeProperty->SetColor(ctfun);
>  volumeProperty->SetScalarOpacity(tfun);
>
>  volume->SetProperty(volumeProperty);
>
>  ----- Original Message -----
> *From:* Ashish Singh <mrasingh at gmail.com>
> *To:* Yixun Liu <yxliu at fudan.edu.cn> ; VTK <vtkusers at vtk.org> ; Sharwari
> Mavalankar <sharwari at gmail.com> ; Amy Squillacote<amy.squillacote at kitware.com>
> *Sent:* Saturday, September 16, 2006 12:07 AM
> *Subject:* Re: [vtkusers] Re: Re: Re: Creating a Volume from 2D BMP files.
>
> Hi Yixun,
>
> My code is exactly same as I posted in my previous message. The only
> changes I made were for setdirectoryname and
> vtkfixedpointvolumeraycastmapper. After that I was getting a rectangular box
> with only images on 2 sides. But now I have added the opacity term as in one
> of your previous messages and I can see the whole volume. It is working fine
> now.
> You can try the code, it is there in one of my previous post.  It will be
> difficult for me to send the dicom images, the dataset is just too big, but
> it should work on any dicom series.
>
> Is there a way to color the volume and see different things in different
> colors in the rendered volume? If anyone knows how to do it, plz let me
> know.
>
> Thanks,
> Ashish
>
> On 9/14/06, Yixun Liu <yxliu at fudan.edu.cn> wrote:
> >
> >  You can send you code and image to me. I will give a test.
> >
> > Yixun
> >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20060918/589ac0fc/attachment.htm>


More information about the vtkusers mailing list