<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Thanks David,<div><br></div><div>I was just ran into this problem the other day and didn't know which Adaptor/Filter to use. In my particular case I have a VectorImage, and wanted to operate some filter on it in a per component basis. This was the missing piece.&nbsp;</div><div><br></div><div>There is the obvious difference between &nbsp;Adaptors and Filters. Aside from that it's very confusion which is correct to use is which scenario. Added to that the confusion between a "Vector Image" and an "Image of Vectors", and things are messy.</div><div><br></div><div>Thanks for your hard work on the Wiki Examples.</div><div><br></div><div>Brad</div><div><br><div><div>On Mar 24, 2011, at 7:06 PM, David Doria wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>On Thu, Mar 24, 2011 at 6:54 PM, David Doria &lt;<a href="mailto:daviddoria@gmail.com">daviddoria@gmail.com</a>&gt; wrote:<br><blockquote type="cite">On Thu, Mar 24, 2011 at 5:12 PM, David Doria &lt;<a href="mailto:daviddoria@gmail.com">daviddoria@gmail.com</a>&gt; wrote:<br></blockquote><blockquote type="cite"><blockquote type="cite">I am having trouble getting this filter to present a scalar image.<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Below is a short example - it creates a vector image and then tries to<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">find the max/min of the adapted scalar image (the 0th component) :<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">typedef itk::VectorImage&lt;float, 2&gt; VectorImageType;<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">VectorImageType::Pointer image;<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">// ... Fill image ...<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">typedef itk::VectorImageToImageAdaptor&lt;float, 2&gt; ImageAdaptorType;<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">ImageAdaptorType::Pointer adaptor = ImageAdaptorType::New();<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">adaptor-&gt;SetExtractComponentIndex(0);<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">adaptor-&gt;SetImage(image);<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">typedef itk::MinimumMaximumImageCalculator &lt;ImageAdaptorType&gt;<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">ImageCalculatorFilterType;<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">ImageCalculatorFilterType::Pointer imageCalculatorFilter =<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">ImageCalculatorFilterType::New();<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">imageCalculatorFilter-&gt;SetImage(adaptor);<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">imageCalculatorFilter-&gt;Compute();<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">The error is:<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">itkImageAdaptor.txx:334: error: cannot convert ‘float*’ to ‘const<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">itk::VariableLengthVector&lt;float&gt;*’ in return<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Is there a different adaptor I am supposed to be using for this?<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Thanks,<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">David<br></blockquote></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">I also tried to use a<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">typedef itk::NthElementImageAdaptor&lt;VectorImageType, float&gt; ImageAdaptorType;<br></blockquote><blockquote type="cite">ImageAdaptorType::Pointer adaptor = ImageAdaptorType::New();<br></blockquote><blockquote type="cite">adaptor-&gt;SelectNthElement(0);<br></blockquote><blockquote type="cite">adaptor-&gt;SetImage(image);<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">as the input to the MinimumMaximumImageCalculator and I get the exact<br></blockquote><blockquote type="cite">same error.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">So to add to the question - what is the difference between<br></blockquote><blockquote type="cite">NthElementImageAdaptor and VectorImageToImageAdaptor?<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">David<br></blockquote><blockquote type="cite"><br></blockquote><br>It seems like itkVectorIndexSelectionCastImageFilter gets the job done.<br><br>So the update is "What is the difference between the following?"<br><br>NthElementImageAdaptor<br>VectorImageToImageAdaptor<br>VectorIndexSelectionCastImageFilter<br>_____________________________________<br>Powered by <a href="http://www.kitware.com">www.kitware.com</a><br><br>Visit other Kitware open-source projects at<br><a href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a><br><br>Kitware offers ITK Training Courses, for more information visit:<br>http://www.kitware.com/products/protraining.html<br><br>Please keep messages on-topic and check the ITK FAQ at:<br>http://www.itk.org/Wiki/ITK_FAQ<br><br>Follow this link to subscribe/unsubscribe:<br>http://www.itk.org/mailman/listinfo/insight-users<br></div></blockquote></div><br><div>
<span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Helvetica" size="3" style="font: 12.0px Helvetica">========================================================</font></p><p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Helvetica" size="3" style="font: 12.0px Helvetica">Bradley Lowekamp<span class="Apple-converted-space">&nbsp;</span><span class="Apple-converted-space">&nbsp;</span></font></p><p style="margin: 0.0px 0.0px 0.0px 0.0px"><font class="Apple-style-span" face="Arial"><span class="Apple-style-span" style="font-family: Arial; "><span class="Apple-style-span" style="font-family: Arial; ">Lockheed Martin&nbsp;</span></span></font><font face="Helvetica" size="3" style="font: 12.0px Helvetica">Contractor for</font></p><p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Helvetica" size="3" style="font: 12.0px Helvetica">Office of High Performance Computing and Communications</font></p><p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Helvetica" size="3" style="font: 12.0px Helvetica">National Library of Medicine<span class="Apple-converted-space">&nbsp;</span></font></p><p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Helvetica" size="3" style="font: 12.0px Helvetica"><a href="mailto:blowekamp@mail.nih.gov">blowekamp@mail.nih.gov</a></font></p><br class="Apple-interchange-newline"></span></span>
</div>
<br></div></body></html>