[Insight-developers] own ImageToImageFilter doesn't work

Mathieu Malaterre mathieu.malaterre at gmail.com
Thu Aug 13 08:41:45 EDT 2009


On Thu, Aug 13, 2009 at 12:20 PM, Mathieu
Malaterre<mathieu.malaterre at gmail.com> wrote:
> On Thu, Aug 13, 2009 at 11:48 AM, Michael
> Siegesmund<TheSmashingPumpkin at web.de> wrote:
>> Hi itk developers,
>>
>> I tried to write my own filter class (inherited from ImageToImageFilter), which encapsulates the functionality of ConnectedThresholdImageFilter.cxx from examples/segmentation.
>> So I took CompositeFilterExample.cxx (from examples/filters) as a template and replaced the core code with the one of ConnectedThresholdImageFilter.cxx.
>> Afterwards I figured out, that I can use my new class for filtering a png file (input=imageFileReader) but if I want to process a CT-image from a dicom reader (which works fine with other filters!) I always get a black screen.
>> And it doesn't matter whether I use an imageviewer or a filewriter for output.
>> The problem sounds like I forgot an important thing to do, for example initialize something. I tried hard, but couldn't find the bug.
>
> I do not know why your filter is not working but you cannot do the following:
>
>> template <class TImageType, class TOutputType>
>> void ConnectedThresholdFilter<TImageType, TOutputType>::GenerateData()
>> {
>>    smoothing->SetInput(this->GetInput());
>>    caster->GraftOutput( this->GetOutput() );
>>    caster->Update();
>>    this->GraftOutput( caster->GetOutput() );
>> }
>
> You cannot call Update since you do not know what is the UpdateExtent.

Indeed you know: caster->GraftOutput( this->GetOutput() );

Sorry for the noise...

-- 
Mathieu


More information about the Insight-developers mailing list