You can find the highest value and corresponding index as you 'draw' the line. Pseudo-code:<div><br></div><div>itk::LineConstIterator<ImageType> it(image, startIndex, endIndex);</div><div>it.GoToBegin();</div>
<div>ImageType::PixelType maxValue = 0;</div><div>ImageType::IndexType maxIndex;</div><div>while(!it.IsAtEnd())</div><div>{</div><div>DrawLine();</div><div>if(it.Get() > maxValue)</div><div> {</div><div> maxValue = it.Get();</div>
<div> maxIndex = it.GetIndex();</div><div> }</div><div>++it;</div><div>}</div><div><br><br><div class="gmail_quote">2011/5/2 LaMoOsH .. <span dir="ltr"><<a href="mailto:xlolla28x@hotmail.com">xlolla28x@hotmail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div>
Hi<br>
<br>
Thank you for your help. <br>
<br>
No, i dont have a list of indices.<br>
I just used the LineConstIterator to draw a line between my two points. <br>
now i need check the gray-level value between these two points and find the pixel with the maximun gray-level value on that line.<br>
so i want my output to be an index.<br>
should i make an if loop inside the while loop that checks for the highest value?<br>
<br>
Thanks . <br>
<br>
<br> <br>
> Date: Sun, 1 May 2011 19:04:45 -0400<br>> Subject: Re: [Insight-users] Gradient Magnitude<br>> From: <a href="mailto:daviddoria@gmail.com" target="_blank">daviddoria@gmail.com</a><br>> CC: <a href="mailto:xlolla28x@hotmail.com" target="_blank">xlolla28x@hotmail.com</a>; <a href="mailto:insight-users@itk.org" target="_blank">insight-users@itk.org</a><div class="im">
<br>> <br>> On Sun, May 1, 2011 at 6:57 PM, Neil Panjwani <<a href="mailto:paniwani@gmail.com" target="_blank">paniwani@gmail.com</a>> wrote:<br>> > If you know the indexes of the line, you could use the image region iterator<br>
> > with index to scan those indices and find the highest value using an if<br>> > statement.<br>> <br>> Here is an example of what Neil suggested (you'd have to check<br>> "iterator.GetIndex() == AnyOfYourIndices" for every pixel visited by<br>
> the iterator):<br>> <a href="http://www.vtk.org/Wiki/ITK/Examples/Iterators/ImageRegionIteratorWithIndex" target="_blank">http://www.vtk.org/Wiki/ITK/Examples/Iterators/ImageRegionIteratorWithIndex</a><br>> <br>
> If you have the end points of the line rather than the list of indices<br>> composing the line, you could use this:<br>> <a href="http://www.vtk.org/Wiki/ITK/Examples/Iterators/LineConstIterator" target="_blank">http://www.vtk.org/Wiki/ITK/Examples/Iterators/LineConstIterator</a><br>
> <br>> David<br>                          
                 </div></div>
<br>_____________________________________<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>
Kitware offers ITK Training Courses, for more information visit:<br>
<a href="http://www.kitware.com/products/protraining.html" target="_blank">http://www.kitware.com/products/protraining.html</a><br>
<br>
Please keep messages on-topic and check the ITK FAQ at:<br>
<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></blockquote></div><br></div>