[ITK] [ITK-users] Multiply two .img or .hdr images in ITK
Bradley Lowekamp
blowekamp at mail.nih.gov
Sun Apr 27 09:30:09 EDT 2014
Hello,
You may be interested in the SimpleITK bindings for ITK. SimpleITK provides an easy to use interface on top of ITK which excels facilitation quick image manipulation with ITK, and enables interactive manipulations with tools such as IPython[1]
SimpleITK for python is readily available as a binary download[2]. What you are looking for can be done in SimpleITK like this:
import SimpleITK as sitk
img1 = sitk.ReadImage("head.img")
img2 = sitk.ReadImage("BrainMask.img")
out = img1*img2
sitk.WriteImage("out.img")
This assumes that the two images occupy the same physical space and are the same pixel type. The binary operators in SimpleITK require that the pixel types are the same, so a cast may be needed.
However, if you are multiplying a mask by the grayscale you may be interested in the MaskImageFilter[3]. This filter will support most combinations and can be used:
sitk.Mask(img1, img2).
Enjoy,
Brad
[1] http://simpleitk.github.io/SimpleITK-Notebooks/
[2] http://www.itk.org/Wiki/SimpleITK/GettingStarted#Downloading_the_binaries
[3] http://www.itk.org/SimpleITKDoxygen/html/classitk_1_1simple_1_1MaskImageFilter.html
On Apr 27, 2014, at 1:39 AM, Pansam Changmi <pansam5green at gmail.com> wrote:
> Hi,
>
> Can anyone tell me how to multiply two .img or .hdr images (for example head.img and BrainMask.img) in ITK? Do I need VTK? ITK-Snap? C3d tool?
>
> Regards,
> Pansam
> _____________________________________
> 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
_____________________________________
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
More information about the Community
mailing list