<div dir="ltr">Hi Tim,<div><br></div><div>Thanks for your reply.</div><div><br></div><div>That is what I could expect - I was planning on starting with ResampleFilter and put in the option of setting a mask in the filter and do modifications accordingly...</div><div><br></div><div>The thing is, since I know the image to be fairly large (in the order of 150x250x120), having this as a multi-threaded filter would be an efficient solution instead of checking for threshold linearly. Also, I would like the flexibility to input the mask from a separate image and not having to do the computation in the main filter, if it can be avoided.</div><div><br></div><div>Best,</div><div>Sarthak <br><div class="gmail_extra"><br><div class="gmail_quote">On 24 May 2016 at 10:56, Timothee Evain <span dir="ltr"><<a href="mailto:tevain@telecom-paristech.fr" target="_blank">tevain@telecom-paristech.fr</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Sarthak,<br>
<br>
That's not really a generic framework so I doubt you will find a ready-to-use filter to do that.<br>
If you want to hide all the processing code you may want to write your own filter.<br>
On a side note, if you're only interested in intensities as output, and willing to discard the correspondance between position and value, why not just compute the otsu threshold, then parse the buffer, adding the value to your vector when it's over/under this threshold (depending on what you consider as background)?<br>
That would be less hassle than a full mask image.<br>
<br>
HTH<br>
Tim<br>
<br>
<br>
----- Mail original -----<br>
De: "Scapegoat Sarthak" <<a href="mailto:scapegoat.sarthak@gmail.com">scapegoat.sarthak@gmail.com</a>><br>
À: "Bradley Lowekamp (NIH/NLM/LHC) [C]" <<a href="mailto:blowekamp@mail.nih.gov">blowekamp@mail.nih.gov</a>>, <a href="mailto:dzenanz@gmail.com">dzenanz@gmail.com</a><br>
Cc: <a href="mailto:insight-users@itk.org">insight-users@itk.org</a><br>
Envoyé: Mardi 24 Mai 2016 16:05:28<br>
Objet: Re: [ITK] [ITK-users] Vectorize/Linearize itk::Image<br>
<div><div class="h5"><br>
Hi Bradley, Dzenan,<br>
<br>
Thanks for your replies. The main idea is the following:<br>
<br>
1. Read image from file -- inputImage<br>
2. Generate a mask to remove background information (either using Otsu or reading another image with this information) -- inputMask<br>
3. Vectorize the inputImage in the region defined by inputMask -- tempColMat or tempRowMat<br>
4. Concatenate multiple tempColMat/tempRowMat -- trainingData<br>
5. Pass trainingData to classifier of choice.<br>
<br>
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.<br>
<br>
Best,<br>
Sarthak<br>
<br>
<br>
On 24 May 2016 at 09:55, Lowekamp, Bradley (NIH/NLM/LHC) [C] < <a href="mailto:blowekamp@mail.nih.gov">blowekamp@mail.nih.gov</a> > wrote:<br>
<br>
<br>
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>
<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>
> _____________________________________<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>
<br>
<br>
_____________________________________<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>_______________________________________________<br>
Community mailing list<br>
<a href="mailto:Community@itk.org">Community@itk.org</a><br>
<a href="http://public.kitware.com/mailman/listinfo/community" rel="noreferrer" target="_blank">http://public.kitware.com/mailman/listinfo/community</a><br>
</blockquote></div><br></div></div></div>