[Insight-users] SimpleITK: GetImageFromArray not working for images larger than 2^32 bytes
Marvin Albert
marvin.albert at gmail.com
Fri Nov 8 10:29:06 EST 2013
Hi Brad,
thanks a lot for your answer!
1) I downloaded sitk 0.7.0 and the problem is still there.
2) Your two lines work fine for me, too. It's the other way which fails,
from array to image.
3) Since my problem occurs doing img = sitk.GetImageFromArray(a), the type
of image is set automatically. My array a is of type numpy.uint16.
This line fails:
img =
sitk._SetImageFromArray(np.ones([2048]*3,dtype=n.uint16),sitk.Image([2048]*3,sitk.sitkUInt16))
4) sys.maxsize gives 2^63
5) My machine is running Ubuntu 10.04, 64Bit and python 2.6
So things should normally work! Any other idea?
Thanks a lot!
Best,
Marvin
2013/11/8 Bradley Lowekamp <brad at lowekamp.net>
> Hello,
>
> I was able to execute the following on my RH6 x64 system from a locally
> built SimpleITK:
>
> img = sitk.Image([2048]*3,sitk.sitkUInt16)
> a = sitk.GetArrayFromImage(img)
>
> Are you able to do a similar test?
>
> There are two things that I am suspicious of the first is the type of
> image you have. Please look at the following:
>
> print img.GetPixelIDTypeAsString()
> print img
>
> This should give you the details of the run-time image information.
>
> If happen to have a RGB image loaded as a Vector image, that is a bit
> different that just a scalar UInt16.
>
> The second possible issue is that there is a binary incompatibility issue
> with your OS and the version you download. So what are the specifics of the
> OS you are using and the python version?
>
> Brad
>
> On Nov 8, 2013, at 8:44 AM, Bradley Lowekamp <brad at lowekamp.net> wrote:
>
> > Do you get the same error with 0.7?
> >
> > http://sourceforge.net/projects/simpleitk/files/SimpleITK/0.7.0/Python/
> >
> > Brad
> >
> > On Nov 8, 2013, at 8:34 AM, Marvin Albert <marvin.albert at gmail.com>
> wrote:
> >
> >> Hi!
> >>
> >> is this the right place for a SimpleITK problem?
> >>
> >> I'm using SimpleITK for carrying out transformations on large images
> within a python environment.
> >>
> >> My problem is that when I want to transform python arrays bigger than
> 2^32 bytes (for example size (1400,1600,2000), uint16) into SimpleITK
> images, it will complain saying
> >>
> >> SimpleITK-0.6.1-py2.6-linux-x86_64.egg_FILES/SimpleITK.pyc in
> GetImageFromArray(arr, isVector)
> >> 298 img = Image( z.shape[::-1], id )
> >> 299
> >> --> 300 _SimpleITK._SetImageFromArray( z.tostring(), img )
> >> 301
> >> 302 return img
> >>
> >> RuntimeError: Size mismatch of image and Buffer.
> >>
> >> As you can see, I'm using the 64Bit binary of SimpleITK under linux and
> there shouldn't be a problem right?
> >>
> >> Thanks a lot in advance!
> >> Best,
> >> Marvin
> >> _____________________________________
> >> 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/20131108/2c5144a4/attachment.htm>
More information about the Insight-users
mailing list