]> Creatis software - bbtk.git/blob - doc/bouml/bbtkk/142466.bodies
.
[bbtk.git] / doc / bouml / bbtkk / 142466.bodies
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
7     typedef T ImageType;
8     // We define the type of the filter to use which is template 
9     // on the image type
10     typedef ExtractImageFilter<ImageType> FilterType;
11     // Allocate the filter
12     typename FilterType::Pointer f = FilterType::New("Temp");
13
14     // Set the input In of the filter
15     // Here we :
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*>() );
22     
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>() );
28
29     // Execute the filter
30     f->bbExecute();
31     // Register its output or it will be deleted we delete the filter
32     f->bbGetOutputOut()->Register();
33     // Set OUR output
34     this->bbSetOutputOut( f->bbGetOutputOut() );
35     // Delete the temporary filter
36     f->bbDelete();
37
38     bbtkDebugDecTab("Core",9);
39