[Insight-users] Gradient Magnitude

robert tamburo robert.tamburo at gmail.com
Mon May 2 09:35:50 EDT 2011


You can find the highest value and corresponding index as you 'draw' the
line. Pseudo-code:

itk::LineConstIterator<ImageType> it(image, startIndex, endIndex);
it.GoToBegin();
ImageType::PixelType maxValue = 0;
ImageType::IndexType maxIndex;
while(!it.IsAtEnd())
{
DrawLine();
if(it.Get() > maxValue)
  {
  maxValue = it.Get();
  maxIndex = it.GetIndex();
  }
++it;
}


2011/5/2 LaMoOsH .. <xlolla28x at hotmail.com>

>  Hi
>
> Thank you for your help.
>
> No, i dont have a list of indices.
> I just used the LineConstIterator to draw a line between my two points.
> 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.
> so i want my output to be an index.
> should i make an if loop inside the while loop that checks for the highest
> value?
>
> Thanks .
>
>
>
> > Date: Sun, 1 May 2011 19:04:45 -0400
> > Subject: Re: [Insight-users] Gradient Magnitude
> > From: daviddoria at gmail.com
> > CC: xlolla28x at hotmail.com; insight-users at itk.org
>
> >
> > On Sun, May 1, 2011 at 6:57 PM, Neil Panjwani <paniwani at gmail.com>
> wrote:
> > > If you know the indexes of the line, you could use the image region
> iterator
> > > with index to scan those indices and find the highest value using an if
> > > statement.
> >
> > Here is an example of what Neil suggested (you'd have to check
> > "iterator.GetIndex() == AnyOfYourIndices" for every pixel visited by
> > the iterator):
> >
> http://www.vtk.org/Wiki/ITK/Examples/Iterators/ImageRegionIteratorWithIndex
> >
> > If you have the end points of the line rather than the list of indices
> > composing the line, you could use this:
> > http://www.vtk.org/Wiki/ITK/Examples/Iterators/LineConstIterator
> >
> > David
>
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.html
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20110502/ba54bf99/attachment.htm>


More information about the Insight-users mailing list