<div dir="ltr"><div><div><div><div><div>Hi!<br></div>I have a goal to manually add trace points to a generated spectrum. The spectrum is a vtkImageData, and the trace line I will create is made with the object vtkImageCanvasSource2D. To merge this on top of each other I use vtkImageBlend. This is pretty much the same procedure as in the example in <a href="http://www.vtk.org/Wiki/VTK/Examples/Cxx/Images/DrawOnAnImage">http://www.vtk.org/Wiki/VTK/Examples/Cxx/Images/DrawOnAnImage</a>.<br>
<br></div>However, the resulting drawing has got a background to the actual drawing. So when I put this on top of my spectrum it is occluded by the background as well as the wanted drawing. The code I use is as follows;<br>
<br><br>Â Â Â // Draw a circle in the center of the image<br>Â Â Â vtkSmartPointer<vtkImageCanvasSource2D> drawing = vtkSmartPointer<vtkImageCanvasSource2D>::New();<br>Â Â Â <br>Â Â Â drawing->SetNumberOfScalarComponents(3);<br>
   <br>   drawing->SetScalarTypeToUnsignedChar();<br>   <br><br>   drawing->SetExtent(image->GetExtent());<br>   drawing->SetDrawColor(0, 0, 0);<br><br>   drawing->DrawCircle(center[0], center[1], radius);<br>
<br>Â Â Â drawing->UpdateWholeExtent();<br><br>Â Â Â // Combine the images (blend takes multiple connections on the 0th<br>Â Â Â // input port)<br>Â Â Â vtkSmartPointer<vtkImageBlend> blend = <br>Â Â Â vtkSmartPointer<vtkImageBlend>::New();<br>
   blend->AddInput(image);<br>   blend->AddInput(drawing->GetOutput());<br><br>   blend->SetOpacity(0,1);<br>   blend->SetOpacity(1,.5); //The transparecy on the drawing<br>   <br>   texture->SetInput(blend->GetOutput());//drawing->GetOutput()); image->GetOutput());<br>
<br></div>Under you can see the different output images I get when adding the different images to the texture. (The circle I use is just for testing.)<br><br></div><div>Does anyone know how to remove this background?<br></div>
<div>I also wonder why the circle has so low resolution. So if anyone has the answer to that as well I it would be really great!<br><br></div><div>Hope to hear from you! :)<br><br></div><div>Best regards,<br></div><div>Morten Wigen<br>
</div><div><br></div>blend:<br><img alt="Inline image 3" src="cid:ii_14560aad1e3954ed" height="109" width="200"><br></div><div>image:<br><img alt="Inline image 4" src="cid:ii_14560ab6de591f0c" height="109" width="200"><br>
</div><br><div><div>drawing:<br><img alt="Inline image 5" src="cid:ii_14560ab8e7592c97" height="109" width="200"><br><br></div></div></div>