[Insight-users] ImageFilter problems

Bill Lorensen bill.lorensen at gmail.com
Fri Dec 23 08:37:00 EST 2011


For a filter to run, you must either explicitly call Update() on it,
or a filter down stream.

Can you show the code that creates averageimage?

Also, you should remove the statement:
averageimage =  shFilter->GetOutput();

It is already used as input to your filter. You are probably
introducing some sort of cycle in the pipeline.

Try
writer->SetInput(shFilter->GetOutput());


On Fri, Dec 23, 2011 at 8:19 AM, Fleysher, Lazar
<lazar.fleysher at mountsinai.org> wrote:
>
>
> Hello insight-users at itk.org.
>
> I am new to ITK and I am experiencing a strange problem with the image filters.
> So I was wondering if someone could shed some light on this.
>
> I have this code
>
>
>  typedef itk::OptimalSharpeningImageFilter<ImageType,ImageType > sharpeningFilter;
>  typename sharpeningFilter::Pointer shFilter = sharpeningFilter::New();
>  shFilter->SetInput( averageimage );
>  shFilter->SetSValue(0.5);
> //  shFilter->Update();
>  averageimage =  shFilter->GetOutput();
>
>
> which should filter the averageimage.
>
> Unfortunately, when I run this code the resulting averageimage contains zero pixels.
> If I uncomment the "Update()" call (which I do not know if is needed) then
> the Update() generates a segmentation violation.
>
>
> I have ITK installed from sources using git clone git://itk.org/ITK.git from
> 2 days ago. I think it is version 4.1.
>
> Also, I have noticed that if I do not call Update() and try to save the image with
>
> typename writertype::Pointer writer = writertype::New();
> writer->SetFileName("aaa");
> writer->SetInput( averageimage );
> writer->Update();
>
> writer->Update() never returns. That is, it cannot write an empty image.
>
> Am I doing something wrong? What is going on?
>
> Thank you very much for your help
>
> Lazar
> _____________________________________
> 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


More information about the Insight-users mailing list