<div dir="ltr">Hi Bradley, Dzenan,<div><br></div><div>Thanks for your replies. The main idea is the following:</div><div><br></div><div>1. Read image from file -- inputImage</div><div>2. Generate a mask to remove background information (either using Otsu or reading another image with this information) -- inputMask</div><div>3. Vectorize the inputImage in the region defined by inputMask -- tempColMat or tempRowMat</div><div>4. Concatenate multiple tempColMat/tempRowMat -- trainingData</div><div>5. Pass trainingData to classifier of choice.</div><div><br></div><div>I have tried both the solutions presented and neither work as optimally as I would like. Ideally, I would like to use a single multi-threaded filter which takes a mask as input along with the mask and extracts pixel values as a vector in return.</div><div><br></div><div>Best,</div><div>Sarthak </div><div><br><div class="gmail_extra"><br><div class="gmail_quote">On 24 May 2016 at 09:55, Lowekamp, Bradley (NIH/NLM/LHC) [C] <span dir="ltr"><<a href="mailto:blowekamp@mail.nih.gov" target="_blank">blowekamp@mail.nih.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">Hello,<br>
<br>
You want to look at the ImportImageContainer[1]. Every itk::Image has one of these object to hold the buffer. The fastest way to “convert” the image, is not to do any work and just get a pointer to the buffer.<br>
<br>
HTH,<br>
Brad<br>
<br>
[1] <a href="https://itk.org/Doxygen/html/classitk_1_1ImportImageContainer.html" rel="noreferrer" target="_blank">https://itk.org/Doxygen/html/classitk_1_1ImportImageContainer.html</a><br>
<div class=""><div class="h5"><br>
> On May 24, 2016, at 9:48 AM, Scapegoat Sarthak <<a href="mailto:scapegoat.sarthak@gmail.com">scapegoat.sarthak@gmail.com</a>> wrote:<br>
><br>
> Hello All,<br>
><br>
> What would be the fastest way to convert an itk::Image< DataType, Dimensions > to a single vector of intensities? Ideally, I would like to concatenate multiple such vectors and pass them to machine learning algorithms.<br>
><br>
> Thanks,<br>
> Sarthak<br>
</div></div><div class=""><div class="h5">> _____________________________________<br>
> Powered by <a href="http://www.kitware.com" rel="noreferrer" 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" rel="noreferrer" 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.php" rel="noreferrer" target="_blank">http://www.kitware.com/products/protraining.php</a><br>
><br>
> Please keep messages on-topic and check the ITK FAQ at:<br>
> <a href="http://www.itk.org/Wiki/ITK_FAQ" rel="noreferrer" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
><br>
> Follow this link to subscribe/unsubscribe:<br>
> <a href="http://public.kitware.com/mailman/listinfo/insight-users" rel="noreferrer" target="_blank">http://public.kitware.com/mailman/listinfo/insight-users</a><br>
<br>
</div></div></blockquote></div><br></div></div></div>