[Insight-users] itk::AdditiveGaussianNoiseImageFilter crashes on creating multiple instances

Prathamesh Kulkarni prathameshmkulkarni at gmail.com
Tue Jul 30 11:21:33 EDT 2013


Still get the same error.


On Tue, Jul 30, 2013 at 10:15 AM, Bill Lorensen <bill.lorensen at gmail.com>wrote:

> Try
> gaussian_noise_filter->UpdateLargestPossibleRegion(); rather than Update().
>
>
> On Tue, Jul 30, 2013 at 11:09 AM, Prathamesh Kulkarni <
> prathameshmkulkarni at gmail.com> wrote:
>
>>
>> Hello,
>>
>> I am trying to create images with varing SNRs using
>> the itk::AdditiveGaussianNoiseImageFilter which I downloaded from
>> http://www.insight-journal.org/browse/publication/721. However, when I
>> create multiple instances of this filter inside a for loop, it crashes.
>>
>> Here is how I do it:
>>
>>  typedef itk::AdditiveGaussianNoiseImageFilter<ImageType3D, ImageType3D>
>> GaussianNoiseFilterType;
>>
>> for(int i = 2; i < 4; i++){
>>  GaussianNoiseFilterType::Pointer gaussian_noise_filter =
>> GaussianNoiseFilterType::New();
>>  gaussian_noise_filter->SetInput(this->PaddedCurvImage);
>>  gaussian_noise_filter->SetMean(mean);
>> gaussian_noise_filter->SetStandardDeviation(sigmas[i]);
>>  std::cout << "sigma: " << sigmas[i] << std::endl;
>>
>>  std::cout << "crash" << std::endl;
>> try{
>>  gaussian_noise_filter->Update();
>> }
>> catch (itk::ExceptionObject &err)
>>  {
>> std::cerr << "Error in gaussian_noise_filter: " << err << std::endl;
>>  }
>>
>> ImageType3D::Pointer noisy_img = gaussian_noise_filter->GetOutput();
>>
>> std::string noisy_out = this->filename;
>> this->WriteImage3D(noisy_out, noisy_img);
>>  }
>>
>> Here is the error it shows:
>>
>> Writing output file ..\test_1_5_noisy_3_noisy.nrrd
>> Error in writing file.
>> itk::ExceptionObject (0000000000B6EDC0)
>> Location: "unknown"
>> File:
>> ..\..\..\..\..\..\src\ITK_git\ITK\Modules\Core\Common\src\itkMultiThreader
>> .cxx
>> Line: 359
>> Description: itk::ERROR: MultiThreader(000000003017C080): Exception
>> occurred during SingleMethodExecute
>>
>> ..\src\itk_git\itk\modules\core\common\include\itkImageConstIterator.h:206:
>> itk::ERROR: Region ImageRegion (0000000000B6EA40)
>>   Dimension: 3
>>   Index: [0, 0, 0]
>>   Size: [606, 474, 24]
>>  is outside of buffered region ImageRegion (0000000002FCA0D0)
>>   Dimension: 3
>>   Index: [0, 0, 0]
>>   Size: [0, 0, 0]
>>
>> I could not make out anything from this error. I have changed the
>> variable *threadId* from *int* to *ThreadIdType *due to another error I
>> was getting.
>>
>> Please guide me on how to fix this error. I need to generate a large
>> number of images using this filter.
>>
>>
>> Thanks,
>> Prathamesh
>>
>> _____________________________________
>> 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
>>
>>
>
>
> --
> Unpaid intern in BillsBasement at noware dot com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20130730/42782b3a/attachment.htm>


More information about the Insight-users mailing list