[Insight-users] Working with RescaleIntensityImageFilter in XCode
Matt McCormick
matt.mccormick at kitware.com
Tue Nov 1 13:00:54 EDT 2011
Hi Rupinder,
Other people have reported issues with LLVM 3.0. Sometimes the
binaries it generates are not valid. LLVM is progressing quickly, but
there are still a few bugs.
Matt
On Tue, Nov 1, 2011 at 12:34 PM, Rupinder Singh
<rupinder.singh123 at yahoo.com> wrote:
> Hello,
> Thank you for your assistance. Sorry for failing to mention the error in the
> previous post. I'm getting "Thread 1: Program received signal:
> "EXC_BAD_ACCESS" ." I was using Xcode 4.2, compiling on a 64 bit intel
> architecture, and using Apple LLVM compiler 3.0.
> After changing my compiler to LLVM GCC 4.2, everything worked perfectly.
> Does anyone know why that would be?
> Thanks again for everyones help.
> Sincerely,
> Rupinder
> On Nov 1, 2011, at 11:15 AM, Bill Lorensen wrote:
>
> This should give you more info:
>
> try
> {
> writer->Update();
> }
> catch( itk::ExceptionObject & exc )
> {
> std::cout << "Caught unexpected exception: "
> << exc;
> return EXIT_FAILURE;
> }
>
>
> On Tue, Nov 1, 2011 at 1:53 AM, cagatay bilgin <bilgincc at gmail.com> wrote:
>>
>> Hello Rupinder,
>>
>> Could it be that your CastFilter's output is of OutputImageType
>> and your Writer's input is of InputImageType and you connect
>> the cast filter's output to the writer filter ? Templating the
>> ImageFileWriter
>> over the OutputImageType might solve your problem. That is instead of
>> typedef itk::ImageFileWriter< InputImageType > WriterType;
>> try
>> typedef itk::ImageFileWriter< OutputImageType > WriterType;
>>
>> PS. You can attach the error to the email for a better diagnosis.
>>
>> Regards,
>> Cagatay
>>
>> On Mon, Oct 31, 2011 at 10:03 PM, Rupinder Singh
>> <rupinder.singh123 at yahoo.com> wrote:
>>>
>>> I'm having difficulty understanding why the following function throws an
>>> exception at 'writer->Update()' whenever it's called.
>>>
>>> const unsigned int Dimension = 2;
>>> typedef unsigned char InputPixelType;
>>> typedef unsigned char OutputPixelType;
>>>
>>> typedef itk::Image< InputPixelType, Dimension > InputImageType;
>>> typedef itk::Image< OutputPixelType, Dimension > OutputImageType;
>>>
>>> void saveITKImage(InputImageType *image)
>>> {
>>> typedef itk::RescaleIntensityImageFilter< InputImageType,
>>> OutputImageType > CastFilterType;
>>> typedef itk::ImageFileWriter< InputImageType >
>>>
>>> WriterType;
>>>
>>> WriterType::Pointer writer = WriterType::New();
>>> CastFilterType::Pointer caster = CastFilterType::New();
>>>
>>> writer->SetFileName("/Users/usr/Desktop/test.jpg");
>>> caster->SetOutputMinimum( 0 );
>>> caster->SetOutputMaximum( 255 );
>>>
>>> // Define Pipeline
>>> caster->SetInput( image );
>>> writer->SetInput( caster->GetOutput() );
>>> writer->Update();
>>>
>>> return;
>>> }
>>>
>>> I know I'm doing something right because the following bit of code works
>>> perfectly when called.
>>>
>>> void saveITKImage(InputImageType *image)
>>> {
>>> typedef itk::ImageFileWriter< InputImageType > WriterType;
>>>
>>> WriterType::Pointer writer = WriterType::New();
>>>
>>> writer->SetFileName("/Users/usr/Desktop/test.jpg");
>>>
>>> // Define Pipeline
>>> writer->SetInput( image);
>>> writer->Update();
>>>
>>> return;
>>> }
>>>
>>> Does anyone know what I'm doing wrong?
>>> Thank you in advance for your help!
>>> _____________________________________
>>> 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
>>>
>>
>>
>> _____________________________________
>> 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
>>
>
>
>
> --
> Unpaid intern in BillsBasement at noware dot 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.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
>
>
More information about the Insight-users
mailing list