<br>Hi Motes,<br><br>You could compose an RGB image to be the final output.<br>In that case you will be able to mark some pixels with a<br>visible color (e.g. red).<br><br>You will find examples on the use of RGB images in the<br>
ITK Software Guide.<br><br> <a href="http://www.itk.org/ItkSoftwareGuide.pdf">http://www.itk.org/ItkSoftwareGuide.pdf</a><br><br>You simply have to use the itk::RGBPixel<> as the pixel<br>type of the image that you compose as output.<br>
<br><br>You may find useful also the following Insight Journal paper:<br><br><a href="http://www.insight-journal.org/browse/publication/79">http://www.insight-journal.org/browse/publication/79</a><br> <a href="http://hdl.handle.net/1926/172">http://hdl.handle.net/1926/172</a><br>
<br><br> Regards,<br><br><br> Luis<br><br>------------------------------------------------------------------------------------<br><div class="gmail_quote">On Sun, Aug 16, 2009 at 4:52 AM, motes motes <span dir="ltr"><<a href="mailto:mort.motes@gmail.com">mort.motes@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">I am looking for a more basic approach. I have tried to update the pixel values manually:<br>
<br><br> void updatePixel(){<br> std::string input = image_dir + "2D/deform/lena.png";<br> std::string output = image_dir + "2D/deform/lena_updated_pixel.png";<br>
<br> fixedImageReader = ImageReaderType::New();<br> WriterType::Pointer writer = WriterType::New();<br> CastFilterType::Pointer caster = CastFilterType::New();<br><br> // Read the input image.<br> fixedImageReader->SetFileName(input);<br>
fixedImageReader->Update(); // make sure this is called before accessing the image.<br><br> // Modify the input image.<br> ImageType::Pointer fixedImage = fixedImageReader->GetOutput();<br> ImageType::IndexType pixelIndex;<br>
pixelIndex[0] = 10;<br> pixelIndex[1] = 10;<br> ImageType::PixelType pixelValue;<br> pixelValue = fixedImage->GetPixel(pixelIndex);<br> std::cout << "pixelValue = " << pixelValue << std::endl;<br>
<br><br> fixedImage->SetPixel(pixelIndex, 255);<br> // Write the output image.<br> writer->SetFileName(output);<br> caster->SetInput(fixedImageReader->GetOutput());<br> writer->SetInput(caster->GetOutput());<br>
try {<br> writer->Update();<br> }<br> catch(itk::ExceptionObject & err) { <br> std::cerr << "ExceptionObject caught !" << std::endl; <br> std::cerr << err << std::endl; <br>
<br> }<br> std::cout << "Updated image: " << output << " stored!\n";<br><br> }<br><br><br>But this not visible unless I update a range of pixels and further it will not work in white areas. Unless there are some "markers" (crosses, triangles, squares - in color) in ITK that can be written to an image I think I will try to do it in gnuplot after the image has been processed.<div>
<div></div><div class="h5"><br>
<br><br><br><br><br><br><br><div class="gmail_quote">On Sun, Aug 16, 2009 at 2:46 AM, Luis Ibanez <span dir="ltr"><<a href="mailto:luis.ibanez@kitware.com" target="_blank">luis.ibanez@kitware.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi Motes,<br><br>Something that comes to mind is that you could mark the closest <br>pixels to your control points in the image that you are saving.<br><br>E.g. if you are using a CT image, you could use values around <br>
2000 to highlight the closest pixel to every control point.<br><br>A second option is that you could create an itkMesh with these<br>points, save it as a vtkPolyData in a .vtk legacy file by using the<br>itkVTKPolyDataWriter, and load it into Paraview, along with your <br>
2D image, then use the Glyph filter on the loaded vtkPolyData.<br><br>You may also find useful this paper from the Insight Journal:<br><br><div>"Gridding Graphic Graticules"</div>
<div>by Tustison N., Avants B., Gee J.</div><a href="http://www.insight-journal.org/browse/publication/140" target="_blank">http://www.insight-journal.org/browse/publication/140</a><br><a href="http://hdl.handle.net/1926/475" target="_blank">http://hdl.handle.net/1926/475</a><br>
<br><br> Regards,<br><br><br> Luis<br><br><br>--------------------------------------------------------------<br><div class="gmail_quote"><div><div></div><div>On Wed, Aug 12, 2009 at 8:02 AM, motes motes <span dir="ltr"><<a href="mailto:mort.motes@gmail.com" target="_blank">mort.motes@gmail.com</a>></span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div></div><div><div><div></div><div><br><div class="gmail_quote">
On Tue, Aug 11, 2009 at 1:41 PM, motes motes <span dir="ltr"><<a href="mailto:mort.motes@gmail.com" target="_blank">mort.motes@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
I am using one of the basic BSplineDeformableTransform examples on some 2D CT images of a brain.<br><br>Now for each 5 or 10 iteration I would like to view the currently registered image and the corresponding BSpline controlpoints (deformation vectors).<br>
<br>Are there any functionality in ITK that deals with this kind of visualization of registered images in progress and the corresponding controlpoints (deformation vectors)?<br>
</blockquote></div><br><br><br><br><br><br><br></div></div>Ok I have now written some code that writes the registered image to disk after a sequence of N iterations.<br>
<br>
In the future I hope to enable movement of control points in my
application. Therefore I would also like to plot the current position
of the control points on the current registered image.<br>
<br>
I am working on the following idea. When I store the current registered
image, I write the position of the control points to a file.<br>
<br>
Later I can (hopefully) in eg. gnuplot load the image and read in the
corresponding control points and plot them on top of the image.<br>
<br>
If anyone know of a better/easier way (maybe ITK already has examples showing this?) they are most welcome to give suggestions!<br>
<br></div></div><div>_____________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at<br>
<a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the ITK FAQ at: <a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
<br></div></blockquote></div><br>
</blockquote></div><br>
</div></div></blockquote></div><br>