[Insight-users] masking part of an image

Bill Lorensen bill.lorensen at gmail.com
Sun Apr 19 15:35:53 EDT 2009


Are the input and input mask the same size? Try printing them.
inputImage->Print(std::cout);
inputMaskImage->Print(std::cout);

after the Update's

2009/4/19 shoosh moosh <babygirl_25 at hotmail.com>:
> Ok, I added the reader->Update(), but now I'm getting a different error:
> Segmentation fault
>
> The program apparently crashes in the for loop.
>
> I think something might be wrong with lines 64-65, but I'm not sure what.
> inputImage=reader1->GetOutput();
> inputMaskImage=reader2->GetOutput();
>
> I attached the code again.
> Thanks
>
>
>
>> Date: Sun, 19 Apr 2009 14:57:47 -0400
>> Subject: Re: [Insight-users] masking part of an image
>> From: bill.lorensen at gmail.com
>> To: babygirl_25 at hotmail.com
>> CC: insight-users at itk.org
>>
>> Do a reader1->Update() and reader2->Update() before accessing the
>> outputs of the reader.
>>
>> 2009/4/19 shoosh moosh <babygirl_25 at hotmail.com>:
>> > Hi,
>> > I wrote up a program that takes as input 2 images - a 3D image, and a 3D
>> > binary mask image with 0's in the parts im not interested and 1's in the
>> > parts I want to segment out. I want the program to simply multiply each
>> > pixel in the original image with the corresponding pixel in the masking
>> > image and produce a third image of the same size having only the region
>> > specified by 1's in the mask. The code compiles, but when I run it, I
>> > get
>> > this error:
>> >
>> > terminate called after throwing an instance of 'itk::ExceptionObject'
>> >   what():
>> > /home/shoosh/InsightToolkit-3.10.2/Code/IO/itkNrrdImageIO.cxx:951:
>> > itk::ERROR: NrrdImageIO(0x8585a50): Write: Error wrapping nrrd for
>> > output.nhdr:
>> > [nrrd] nrrdWrap_nva:
>> > [nrrd] _nrrdSizeCheck: axis 0 size is zero!
>> >
>> > Can some one tell me how to fix it. the code is attached.
>> >
>> >
>> >
>> > ________________________________
>> > Get news, entertainment and everything you care about at Live.com. Check
>> > it
>> > out!
>> > _____________________________________
>> > Powered by www.kitware.com
>> >
>> > Visit other Kitware open-source projects at
>> > http://www.kitware.com/opensource/opensource.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
>> >
>> >
>
> ________________________________
> See all the ways you can stay connected to friends and family


More information about the Insight-users mailing list