[Insight-users] Overlay segmented binary image on vtkImageViewer2

Xiaopeng Yang yxp233 at postech.ac.kr
Thu Feb 17 07:40:25 EST 2011


Wow, that’s a great project! But it is hard for me to understand it. I applied vtkImageBlend to combine the original and mask images. That’s a pretty easy way for me. But I cannot change the mask image color. Do you have any idea to change the mask image color?

 

 

  vtkSmartPointer<vtkLookupTable> table1 = vtkSmartPointer<vtkLookupTable>::New();

  table1->SetRange(100, 150); 

  table1->SetValueRange(0.0, 1.0); 

  table1->SetSaturationRange(0.0, 0.0); 

  table1->SetRampToLinear();

  table1->Build();

 

  vtkSmartPointer<vtkImageMapToColors> color1 = vtkSmartPointer<vtkImageMapToColors>::New();

  color1->SetLookupTable(table1);

  color1->SetInput(Original->GetOutput());//original image 

color1->Update();

 

  vtkSmartPointer<vtkLookupTable> table2 = vtkSmartPointer<vtkLookupTable>::New();

  table2->SetRange(0, 255); 

  table2->SetValueRange(0,1); 

  table2->SetSaturationRange(0.0, 0.0); 

  table2->SetRampToLinear();

  table2->Build();

 

  vtkSmartPointer<vtkImageMapToColors> color2 = vtkSmartPointer<vtkImageMapToColors>::New();

  color2->SetLookupTable(table2);

  color2->SetInput(Mask->GetOutput());//mask image

  color2->Update();

 

  vtkSmartPointer<vtkImageBlend> imgBlender = 

      vtkSmartPointer<vtkImageBlend>::New();

  imgBlender->SetOpacity( 0, 1 );

  imgBlender->SetOpacity( 1, 0.3 );

 

  imgBlender->SetInput( 0, color1->GetOutput() );

  imgBlender->SetInput( 1, color2->GetOutput() );

 

vtkImageViewer2 *imageViewer1 = vtkImageViewer2::New();

…

 



 

Thanks,

Yang

 

发件人: David Doria [mailto:daviddoria at gmail.com] 
发送时间: 2011년 2월 17일 목요일 오후 9:25
收件人: Xiaopeng Yang
抄送: vtk; insight-users at itk.org
主题: Re: [Insight-users] Overlay segmented binary image on vtkImageViewer2

 

On Thu, Feb 17, 2011 at 4:38 AM, Xiaopeng Yang <yxp233 at postech.ac.kr> wrote:

Hello,

 

I am trying to overlay the segmented binary image on vtkImageViewer2. The supposed result should look like this:

 



 

Does anyone have any good ideas??

 

Thanks,

Xiaopeng

 

 

I do a binary mask overlay in this project:

 

https://github.com/daviddoria/StructurePropagation


Take a look at the LoadMask here https://github.com/daviddoria/StructurePropagation/blob/master/InnerWidget.txx





Also, these two examples show two methods of doing this (VTK only)

http://www.vtk.org/Wiki/VTK/Examples/Cxx/Visualization/ImageTransparency

http://www.vtk.org/Wiki/VTK/Examples/Cxx/Images/Transparency





David

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20110217/dadf44c6/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/octet-stream
Size: 7891 bytes
Desc: not available
URL: <http://www.itk.org/pipermail/insight-users/attachments/20110217/dadf44c6/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/octet-stream
Size: 11351 bytes
Desc: not available
URL: <http://www.itk.org/pipermail/insight-users/attachments/20110217/dadf44c6/attachment-0001.obj>


More information about the Insight-users mailing list