<div dir="ltr">Hi Lambert,<div><br></div><div>What you could do is to make a function what just takes in a file name as input and call the templated ITK function inside as an inline function. There is no way I know to do I/O in ITK without using templates.</div><div><br></div><div>Best,</div><div>Sarthak <br><div class="gmail_extra"><br><div class="gmail_quote">On 10 March 2016 at 10:55, Lambert Zijp <span dir="ltr"><<a href="mailto:ljzijp@gmail.com" target="_blank">ljzijp@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Scapegoat,<div>Thank you for responding. What would the function prototype then be (of function that accepts any itk image. I mean, the syntax, preferably not templated)?</div><div>Because I deal mostly with 3D or 4D signed short pixels (medical images), I keep them as they are: half the memory consumption and easier histogram computations.</div><div><br></div><div>Greetings,</div><div>Lambert</div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Mar 10, 2016 at 4:35 PM, Scapegoat Sarthak <span dir="ltr"><<a href="mailto:scapegoat.sarthak@gmail.com" target="_blank">scapegoat.sarthak@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I would advice you to perform a check on the image dimensions (2 or 3) and keep the pixel type as float throughout. In any case you will be doing computation so the extra memory is going to be helpful.<div><div><br><div class="gmail_extra"><br><div class="gmail_quote">On 10 March 2016 at 10:28, Matt McCormick <span dir="ltr"><<a href="mailto:matt.mccormick@kitware.com" target="_blank">matt.mccormick@kitware.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Lambert,<br>
<br>
This example shows how to read in an unknown image type. It<br>
demonstrates how to go between run-time type specification and the<br>
compile-image type specification of ITK.<br>
<br>
  <a href="http://itk.org/ITKExamples/src/IO/ImageBase/ReadUnknownImageType/Documentation.html" rel="noreferrer" target="_blank">http://itk.org/ITKExamples/src/IO/ImageBase/ReadUnknownImageType/Documentation.html</a><br>
<br>
This approach could be used for your problem.<br>
<br>
HTH,<br>
Matt<br>
<div><div><br>
On Thu, Mar 10, 2016 at 9:56 AM, Lambert Zijp <<a href="mailto:ljzijp@gmail.com" target="_blank">ljzijp@gmail.com</a>> wrote:<br>
> Dear itk users,<br>
> I'm new to itk and also not very proficient in C++...<br>
> I want to try some deformable registration methods implemented in itk, and<br>
> need to convert my own format of images and volumes to itk, and back.<br>
> For conversion to itk, I use 'ImportImageFilter', because I do not want to<br>
> make a copy of the pixels/voxels.<br>
> Converting itk images and volumes back to my own format, is giving me a<br>
> headache; I'm confused about 'Image', SmartPointer and ConstPointer and<br>
> template stuff.<br>
> Could you get me started by suggesting me a function prototype?<br>
><br>
> Something like:<br>
> int ItkToMyFormat(MyFormat** ppMyFormat, itk::Image* pItkImage);<br>
><br>
> The ItkImage can be any pixeltype, any dimension, and vector images should<br>
> also be accepted by the conversion routine. In that conversion function, and<br>
> need to be able to put a switch on pixeltype and number of dimensions.<br>
><br>
> Greetings,<br>
> Lambert<br>
><br>
</div></div>> _____________________________________<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>
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>
</blockquote></div><br></div></div></div></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div></div></div>