<div dir="ltr">Hi,<div>I'm assuming you really want a 3d watershed, since you are starting with nifti, rather than a series of 2D versions. If you are interested in a series of 2d versions, then you might try nifti to tiff with convert3d, then extract the tiff slices with tiffsplit, then tifftopgm with the image magick tools.</div>
<div><br><div>The README with the power watershed code  says that the 3d format is a very simple header followed by the data, so your best bet is to probably do it manually. Use convert3d, or equivalent tool to change the nii to a format that has separate data and header sections (or strip the nii header off), making sure that you have unsigned char data. Then manually construct the text header and join the two together. It appears that the text header should look like this:</div>
<div><br></div><div>P5</div><div>xsize ysize zsize</div><div>255</div><div><br></div><div>Then do the reverse to get back to a nifti file. Seems that the extended pgm format doesn't know about voxel sizes, so you may get weird results if the data is highly anisotropic.</div>
</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Feb 28, 2014 at 1:11 AM, Nicolas Cordier <span dir="ltr"><<a href="mailto:nicolas.cordier@inria.fr" target="_blank">nicolas.cordier@inria.fr</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div style="font-size:12pt;font-family:times new roman,new york,times,serif"><div>Hello,<br></div><div><br></div><div>
There is a tool (Power Watershed) from ICCV 2009 which only accepts .ppm images:</div><div><a href="http://powerwatershed.sourceforge.net/" target="_blank">http://powerwatershed.sourceforge.net/</a></div><div><br></div><div>
It seems convert3d does not support this image format, which I suspect is the following one:<br></div><div><a href="http://netpbm.sourceforge.net/doc/pgm.html" target="_blank"></a><a>http://netpbm.sourceforge.net/doc/pgm.html</a></div>
<div><br></div><div>Is there an easy way to convert my .nii (3D images) to .pgm files? Apply this tool and then convert the way back?<br></div><div><br></div><div>Best regards,</div><span class="HOEnZb"><font color="#888888"><div>
<span name="x"></span><span style="font-family:times new roman,new york,times,serif;font-size:medium" size="3">--</span><span style="font-family:times new roman,new york,times,serif;font-size:medium" size="3"> </span><span style="font-family:arial,helvetica,sans-serif;font-size:xx-small" size="1"><br>
<img src="cid:474c44f78ae55640301918fa5c39a622c13cdd43@zimbra" style="border:0px"><br></span><p style="font-family:arial,helvetica,sans-serif"><span style="font-size:xx-small" size="1">
        </span><span style="font-family:arial,helvetica,sans-serif;font-size:xx-small" size="1"><span><strong><strong>Nicolas CORDIER</strong></strong><br></span></span></p>
      <p style="font-family:arial,helvetica,sans-serif"><span style="font-size:xx-small" size="1"><span><a href="http://www-sop.inria.fr/asclepios/" target="_blank">ASCLEPIOS</a> </span></span><span style="font-size:xx-small" size="1"><span>PhD Candidate</span></span></p>
<p style="font-family:arial,helvetica,sans-serif"><span style="font-size:xx-small" size="1"><br></span><span style="font-size:xx-small" size="1"><span></span></span></p><p style="font-family:arial,helvetica,sans-serif"><span style="font-family:arial,helvetica,sans-serif;font-size:xx-small" size="1"><strong><span><a href="http://www.inria.fr/centre/sophia/" target="_blank">INRIA SOPHIA
                ANTIPOLIS - MEDITERRANEE</a></span></strong></span><span style="font-size:xx-small" size="1"><br></span><span style="font-size:xx-small" size="1"><span></span></span></p><p style="font-family:arial,helvetica,sans-serif">
<span style="font-size:xx-small" size="1"><span>2004 route des Lucioles, BP93, 06902 Sophia Antipolis Cedex, FR<br>
          Tel : +33 (0)4 </span>92 38 79 26 - Fax : <a href="tel:%2B33%20%280%294%2092%2038%2076%2069" value="+33492387669" target="_blank">+33 (0)4 92 38 76 69</a></span></p><p style="font-family:arial,helvetica,sans-serif">
<span style="font-size:xx-small" size="1"><br></span>
        </p><span style="font-size:xx-small" size="1"><strong style="font-family:arial,helvetica,sans-serif"><span style="color:#ff0000" color="#ff0000"><span></span></span></strong></span><span name="x"></span><br></div>
</font></span></div></div><br>_____________________________________<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>