<div dir="ltr"><div style>glad it helped!</div><div style><br></div><div style>almost all the examples cast the input type to internal type (float or double) for processing, and then they cast the internal image to an output type. It's more accurate to work with floating point types for processing, especially with filters that do differential computations, smoothing, optimization, etc. etc.</div>
<div style>Obviously be sure you don't exceed the numeric_limits of a data type, for example if for some reasons you have to cast a CT image with values in HU (in a range [-1200, 3000]) to an unsigned char type (which is in a range [1,255]), you might want to stretch the intensity values beforehand.</div>
<div style><br></div><div style>Have fun!</div><div style><br></div><div style>ciao,</div><div style>Mauro</div><div><br></div><div><br></div>On Thu, Dec 12, 2013 at 10:35 PM, elena bresciani <span dir="ltr"><<a href="mailto:elena.bresciani87@gmail.com" target="_blank">elena.bresciani87@gmail.com</a>></span> wrote:<br>
<div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">
<div><div><div>Ok ok, I get it! :)<br><br></div>Thank you very much<br><br></div>Cheers,<br></div>Elena<br><br></div><div class=""><div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">2013/12/12 Mauro Maiorca <span dir="ltr"><<a href="mailto:mauromaiorca@gmail.com" target="_blank">mauromaiorca@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div>On Thu, Dec 12, 2013 at 9:06 PM, elena bresciani <span dir="ltr"><<a href="mailto:elena.bresciani87@gmail.com" target="_blank">elena.bresciani87@gmail.com</a>></span> wrote:<br>
</div><div><div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div dir="ltr"><div></div></div></blockquote></div><div><div>> Ok, thanks but my question was more like How can I know which input image type requires a particular filter?<br></div></div><div><br></div></div>ah okay! Any descent of ImageToImageFilter it is meant to support at least all the native types such as float, char, int, and so on. As all the classes are templated, so the numeric types are those compatible with your C++ compiler. However, when you write an image on a file you are restricted on the data types supported by the image format you are using, for example MRCImageIO complains with scalar double types, while double type works perfectly fine with MetaIO format.<div>
<div>
<div><br></div><div>> For example: itk::GradientMagnitudeImageFilter requires the input image to have a float pixel type (as described in the software guide). </div><div>> Where can I find this kind of informations? <span style="font-size:13.333333969116211px;font-family:arial,sans-serif"><br>
</span></div><div><span style="font-size:13.333333969116211px;font-family:arial,sans-serif"><br></span></div></div><div><span style="font-size:13.333333969116211px;font-family:arial,sans-serif">In the case of </span><span style="font-size:13.333333969116211px;font-family:arial,sans-serif">itk::</span><span style="font-size:13.333333969116211px;font-family:arial,sans-serif">GradientMagnitudeImageFilter you might want to have a floating point pixel values, as you might want a continuous histogram, i.e. you don't want to approximate real values to an integer type, as you loose all the decimals. </span><font face="arial, sans-serif">But </font><span style="font-size:13.333333969116211px;font-family:arial,sans-serif">itk::</span><span style="font-size:13.333333969116211px;font-family:arial,sans-serif">GradientMagnitudeImageFilter</span><font face="arial, sans-serif"> works perfectly fine with integers too. Another example, if you want to threshold an image, it's unnecessary to use a floating point pixel type, as usually you need to store integer values, not decimals. But it works perfectly fine using floating pixel types. It really depends on what is the problem you are going to solve. D</font><span style="font-size:13.333333969116211px;font-family:arial,sans-serif">oes it make sense? </span></div>
<div><span style="font-family:arial,sans-serif;font-size:13.333333969116211px"><br></span></div><div><span style="font-family:arial,sans-serif;font-size:13.333333969116211px">cheers,</span></div><div><span style="font-family:arial,sans-serif;font-size:13.333333969116211px">Mauro</span></div>
<div><div>
<div><div><br><div><br><div><div><br></div><div><br></div></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div><div><div class="gmail_extra"><div class="gmail_quote">2013/12/12 Mauro Maiorca <span dir="ltr"><<a href="mailto:mauromaiorca@gmail.com" target="_blank">mauromaiorca@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">Hi Elena,<div><br></div><div>have a look at the ITK software guide (<a href="http://www.itk.org/ItkSoftwareGuide.pdf" target="_blank">http://www.itk.org/ItkSoftwareGuide.pdf</a>), chapter 4 (User's guide -> Data Representation -> Image), it might answer your question.</div>
<div><br></div><div>Section 4.1.1 shows how to create a 3D image with unsigned short pixel data, in summary you have to define your image type as:</div><div><div>typedef itk::Image< unsigned short, 3 > ImageType;<br>
</div><div>If you want to create an image with unsigned int pixel data, you have to replace "unsigned short" with "unsigned int", i.e.</div><div>typedef itk::Image< unsigned int, 3 > ImageType;<br>
</div><div><br></div><div>You can play with the examples that you can find either in your ITK source directory (Examples/DataRepresentation/Image/Image1.cxx, etc etc) or online (<a href="https://github.com/Kitware/ITK/blob/master/Examples/DataRepresentation/Image/Image1.cxx" target="_blank">https://github.com/Kitware/ITK/blob/master/Examples/DataRepresentation/Image/Image1.cxx</a> etc etc)</div>
<div><br></div><div>If you want to cast image types (for example converting from unsigned short to unsigned int), have a look at section "6.3 Casting and Intensity Mapping" of the ITK software guide.</div>
<div><br></div><div>Hope it helps.</div><div><br></div><div>cheers,</div><div>Mauro</div><div><br></div><div><br></div><div><br></div></div></div><div class="gmail_extra"><br>
<br><div class="gmail_quote"><div><div>On Thu, Dec 12, 2013 at 8:19 PM, elena bresciani <span dir="ltr"><<a href="mailto:elena.bresciani87@gmail.com" target="_blank">elena.bresciani87@gmail.com</a>></span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div><div>
<div dir="ltr"><div><div><div><div>Hi to everybody,<br><br></div>I have a (probably really silly) question about which kind of input image pixel type does a filter require.<br>Is it wrote in the doxygen documentation? If yes, where? <br>
<br></div>I'm obviously a beginner and I can't understand well how to read the documentation...<br><br></div>Thank you in advance,<br><br></div>Elena<br><div><div><div><div><br><br></div></div></div></div></div>
<br></div></div>_____________________________________<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.php" 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" 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>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div></div></div></div></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div></div>