[Insight-users] Question about setRegions

Karthik Krishnan karthik.krishnan at kitware.com
Tue Nov 10 02:31:31 EST 2009


Its likely that image is null.. you might be creating a smartpointer in
function and passing it out a raw pointer.. Please use a debugger and read
the guide about smart pointers.

On Mon, Nov 9, 2009 at 1:49 PM, Yili Pan <pyl0420 at gmail.com> wrote:

> Hi everyone:
>
> I'm trying to get a specific slice of the volume:
>
>                         index[0]=sliceNum;
> ImageType::RegionType regionImg;
>  ImageType::IndexType start;
> start[0]=0;
> start[1]=0;
>  ImageType::SizeType sizeImg;
> sizeImg[0]=size[1];
> sizeImg[1]=size[2];
>  regionImg.SetIndex(start);
> regionImg.SetSize(sizeImg););
> image->SetRegions(regionImg);
>  image->Allocate();
> Then I use getPixel and setPixel to read the pixel value of volume and set
> the value of  corresponding  position.
> This method worked, but when I tried to write it as a function, the problem
> came.
> The program broke at image->SetRegions(regionImg)
>
> Could you help me with this problem? If I write it in the main function,
> the whole program would be very long
>
> Thanks a lot!!
>
> Best,
> Yili
>
> _____________________________________
> 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.html
>
> 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/20091110/1f310151/attachment.htm>


More information about the Insight-users mailing list