[IGSTK-Users] Setting a color to ImageSpatialObjectRepresentation = Segmentation Fault

Andinet Enquobahrie andinet.enqu at kitware.com
Mon Jan 7 11:16:09 EST 2008


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
>>
>


-- 
==========================================================
Andinet A. Enquobahrie, PhD
R&D Engineer
Kitware Inc.

28 Corporate Drive
Clifton Park, NY 12065-8662
Phone: 518-371-3971 x124
www.kitware.com





More information about the IGSTK-Users mailing list