1 class ExtractImageFilterGeneric
2 !!!185858.cpp!!! Process() : void
3 bbtkDebugMessageInc("Core",9,
4 "bbitk::ExtractImageFilterGeneric::Process<"
5 <<bbtk::TypeName<T>()<<">()"<<std::endl);
6 // T is the type of input image
8 // We define the type of the filter to use which is template
10 typedef ExtractImageFilter<ImageType> FilterType;
11 // Allocate the filter
12 typename FilterType::Pointer f = FilterType::New("Temp");
14 // Set the input In of the filter
16 // 1) Get **OUR** input 'In' by bbGetInputIn()
17 // It is a anyImagePointer
18 // 2) We **KNOW** that the actual type stored by the anyImagePointer
19 // is ImageType* hence we get the value stored using the
20 // unsafe_get method (which is a template method on the return type)
21 f->bbSetInputIn( this->bbGetInputIn().unsafe_get<ImageType*>() );
23 // The same for the ImageRegion except that we use 'get' and not
24 // 'unsafe get' because the region dimension passed by the user may not be
25 // compatible with the image dimension.
26 // If get fails it throws an exception which must be caught outside
27 f->bbSetInputExtractionRegion ( this->bbGetInputRegion().get<typename T::RegionType>() );
31 // Register its output or it will be deleted we delete the filter
32 f->bbGetOutputOut()->Register();
34 this->bbSetOutputOut( f->bbGetOutputOut() );
35 // Delete the temporary filter
38 bbtkDebugDecTab("Core",9);