[Insight-users] PGM from NII with ITK

Richard Beare richard.beare at gmail.com
Thu Feb 27 15:19:00 EST 2014


Hi,
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.

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:

P5
xsize ysize zsize
255

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.


On Fri, Feb 28, 2014 at 1:11 AM, Nicolas Cordier
<nicolas.cordier at inria.fr>wrote:

> Hello,
>
> There is a tool (Power Watershed) from ICCV 2009 which only accepts .ppm
> images:
> http://powerwatershed.sourceforge.net/
>
> It seems convert3d does not support this image format, which I suspect is
> the following one:
> <http://netpbm.sourceforge.net/doc/pgm.html>
> http://netpbm.sourceforge.net/doc/pgm.html
>
> Is there an easy way to convert my .nii (3D images) to .pgm files? Apply
> this tool and then convert the way back?
>
> Best regards,
> --
>
> *Nicolas CORDIER*
>
> ASCLEPIOS <http://www-sop.inria.fr/asclepios/> PhD Candidate
>
>
> *INRIA SOPHIA ANTIPOLIS - MEDITERRANEE
> <http://www.inria.fr/centre/sophia/>*
>
> 2004 route des Lucioles, BP93, 06902 Sophia Antipolis Cedex, FR
> Tel : +33 (0)4 92 38 79 26 - Fax : +33 (0)4 92 38 76 69
>
>
>
>
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.php
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20140228/738a68cd/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: inria-logo-mail-scientifique-gb.jpg
Type: image/jpeg
Size: 5712 bytes
Desc: not available
URL: <http://www.itk.org/pipermail/insight-users/attachments/20140228/738a68cd/attachment.jpg>


More information about the Insight-users mailing list