[ITK] [ITK-users] SimpleITK Downsampling results in blank image
jmerkow
jmerkow at gmail.com
Mon Nov 17 18:20:10 EST 2014
I have a strange issue when using the Resample procedural interface in
SimpleITK.
I have tried all the call signatures, but I can't seem to get meaningful
output.
I wrote a small illustrative example, where I read an image, attempt to
downsample by 2, and get nothing out. This is written in python, using
SimpleITK 0.8.0.
Code:
import SimpleITK as sitk
image = sitk.ReadImage('/path/to/img/cabg11-1.mha')
image = sitk.Cast(sitk.RescaleIntensity(image), sitk.sitkFloat32)
scale = 2.0
iscale = 1/scale;
sz1,sp1,origin = image.GetSize(),image.GetSpacing(), image.GetOrigin()
direction = image.GetDirection()
sz2,sp2 = [int(n/scale) for n in sz1],[n*scale for n in sp1]
print "Orig Size ", sz1, "\nNew Size ", sz2
print "Orig Sp ", sp1, "\nNew Sp ", sp2
print origin
t = sitk.Transform(3, sitk.sitkScale)
t.SetParameters((scale, scale, scale))
simage =
sitk.Resample(image,sz2,t,sitk.sitkLinear,origin,sp2,direction,0.0,sitk.sitkFloat32)
print "New Image size:", simage.GetSize()
mmap = sitk.Statistics(simage)
for n in mmap.items():
print n
print "\n",sitk.Version()
Output:
Orig Size (170, 170, 130)
New Size [85, 85, 65]
Orig Sp (0.03867189958691597, 0.03867189958691597, 0.0625)
New Sp [0.07734379917383194, 0.07734379917383194, 0.125]
(-13.1871, 6.57422, -16.3125)
New Image size: (85, 85, 65)
('Maximum', 0.0)
('Mean', 0.0)
('Minimum', 0.0)
('Sigma', 0.0)
('Sum', 0.0)
('Variance', 0.0)
SimpleITK Version: 0.8.0
Compiled: Mar 14 2014 02:43:02
Am I missing a step here?
-Jameson
--
View this message in context: http://itk-users.7.n7.nabble.com/SimpleITK-Downsampling-results-in-blank-image-tp34923.html
Sent from the ITK - Users mailing list archive at Nabble.com.
_____________________________________
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://public.kitware.com/mailman/listinfo/insight-users
More information about the Community
mailing list