[IGSTK-Users] Setting a color to ImageSpatialObjectRepresentation = Segmentation Fault
Vincent Gratsac
vincent.gratsac at irisa.fr
Thu Jan 31 11:05:59 EST 2008
Hi Andinet,
I noted that the modifications you made to the IGSTK cvs do not contain
the line concerning the opacity :
> m_LUT->SetAlphaRange(m_Opacity, m_Opacity);
Is it because you don't want an ImageSpatialObjectRepresentation being
able to be transparent ?
Vincent
Andinet Enquobahrie wrote:
> Hi Vincent.
>
> Thanks for your contribution!
>
> We will review it and make the modification to the main CVS.
>
> -Andinet
>
>> Hi igstk-users,
>>
>> I made some modifications to
>> igstkImageSpatialObjectRepresentation.txx code in order to correct my
>> problem when setting a color or an opacity to an image spatial object.
>> Here are the few lines that have been changed in CreateActors() method:
>>
>>> // Converting RGB color to HSV values float hue=0;
>>> float saturation=0;
>>> float value=0;
>>> vtkMath::RGBToHSV(this->GetRed(), this->GetGreen(),
>>> this->GetBlue(),&hue, &saturation, &value);
>>>
>>> m_LUT->SetTableRange ( (m_Level - m_Window/2.0), (m_Level +
>>> m_Window/2.0) ); m_LUT->SetSaturationRange (saturation,
>>> saturation);
>>> m_LUT->SetHueRange (hue, hue);
>>> m_LUT->SetValueRange (0, value);
>>> m_LUT->SetAlphaRange(m_Opacity, m_Opacity);
>>> m_LUT->SetRampToLinear();
>>>
>>>
>>> m_MapColors->SetLookupTable( m_LUT );
>>
>> Note that you have to include vtkMath.h file.
>>
>> I hope this code will help someone, or could be integrate to IGSTK in
>> the future.
>>
>> Have a nice day,
>>
>> Vincent
>>
>> Vincent Gratsac a écrit :
>>
>>> Hi igstk-users,
>>>
>>> I'm trying to set a color (other than white) to an
>>> ImageSpatialObjectRepresentation.
>>> With my application, it causes a segmentation fault. I add one line
>>> in the NeedleBiopsy example to check that it does not come from by
>>> code and I also get a seg fault :
>>>
>>>> m_ImageRepresentationAxial->SetColor(0.5,1,1);
>>>
>>>
>>> Is it a bug or did I make a mistake ?
>>>
>>> Note that my code works fine while setting the color the a
>>> MeshObjectRepresentation.
>>>
>>> Vincent
>>>
>>
>
>
--
Vincent Gratsac
----------------------------------------------------
Unité/Projet VisAGeS U746
INSERM/INRIA/CNRS/U. de Rennes I
IRISA
Campus de Beaulieu, 35042 Rennes Cedex, France
Ph: +33 (0) 2 23 23 49 20/ Fax: +33/0 2 99 84 71 71
email: Vincent.Gratsac at irisa.fr
http://www.irisa.fr/visages/
-----------------------------------------------------
More information about the IGSTK-Users
mailing list