Authors belong to:
- University of LYON http://www.universite-lyon.fr/
- - Léon Bérard cancer center http://oncora1.lyon.fnclcc.fr
+ - Léon Bérard cancer center http://www.centreleonberard.fr
- CREATIS CNRS laboratory http://www.creatis.insa-lyon.fr
This software is distributed WITHOUT ANY WARRANTY; without even
- BSD See included LICENSE.txt file
- CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
- ======================================================================-====*/
+ ===========================================================================**/
#ifndef CLITKEXTRACTMEDIASTINUMSGENERICFILTER_TXX
#define CLITKEXTRACTMEDIASTINUMSGENERICFILTER_TXX
//--------------------------------------------------------------------
template<class ArgsInfoType>
-clitk::ExtractMediastinumGenericFilter<ArgsInfoType>::ExtractMediastinumGenericFilter():
+clitk::ExtractMediastinumGenericFilter<ArgsInfoType>::
+ExtractMediastinumGenericFilter():
ImageToImageGenericFilter<Self>("ExtractMediastinum")
{
// Default values
//--------------------------------------------------------------------
template<class ArgsInfoType>
template<unsigned int Dim>
-void clitk::ExtractMediastinumGenericFilter<ArgsInfoType>::InitializeImageType()
+void
+clitk::ExtractMediastinumGenericFilter<ArgsInfoType>::
+InitializeImageType()
{
- ADD_IMAGE_TYPE(Dim, uchar);
- // ADD_IMAGE_TYPE(Dim, short);
- // ADD_IMAGE_TYPE(Dim, int);
- // ADD_IMAGE_TYPE(Dim, float);
+ ADD_IMAGE_TYPE(Dim, short);
}
//--------------------------------------------------------------------
//--------------------------------------------------------------------
template<class ArgsInfoType>
-void clitk::ExtractMediastinumGenericFilter<ArgsInfoType>::SetArgsInfo(const ArgsInfoType & a)
+void
+clitk::ExtractMediastinumGenericFilter<ArgsInfoType>::
+SetArgsInfo(const ArgsInfoType & a)
{
mArgsInfo=a;
SetIOVerbose(mArgsInfo.verbose_flag);
if (mArgsInfo.imagetypes_flag) this->PrintAvailableImageTypes();
- if (mArgsInfo.patient_given) AddInputFilename(mArgsInfo.patient_arg);
- if (mArgsInfo.lung_given) AddInputFilename(mArgsInfo.lung_arg);
- if (mArgsInfo.bones_given) AddInputFilename(mArgsInfo.bones_arg);
+ if (mArgsInfo.input_given) AddInputFilename(mArgsInfo.input_arg);
if (mArgsInfo.output_given) AddOutputFilename(mArgsInfo.output_arg);
}
//--------------------------------------------------------------------
+//--------------------------------------------------------------------
+template<class ArgsInfoType>
+template<class FilterType>
+void
+clitk::ExtractMediastinumGenericFilter<ArgsInfoType>::
+SetOptionsFromArgsInfoToFilter(FilterType * f)
+{
+ f->SetVerboseOptionFlag(mArgsInfo.verbose_flag);
+ f->SetVerboseStepFlag(mArgsInfo.verboseStep_flag);
+ f->SetWriteStepFlag(mArgsInfo.writeStep_flag);
+ f->SetAFDBFilename(mArgsInfo.afdb_arg);
+ f->SetOutputMediastinumFilename(mArgsInfo.output_arg);
+ f->SetVerboseMemoryFlag(mArgsInfo.verboseMemory_flag);
+
+ f->SetDistanceMaxToAnteriorPartOfTheVertebralBody(mArgsInfo.maxAntSpine_arg);
+ f->SetUseBones(mArgsInfo.useBones_flag);
+
+ // Set RelativePositionList filenames
+ for(uint i=0; i<mArgsInfo.relpos_given; i++) {
+ f->AddRelativePositionListFilename(mArgsInfo.relpos_arg[i]);
+ }
+}
+//--------------------------------------------------------------------
+
+
//--------------------------------------------------------------------
// Update with the number of dimensions and the pixeltype
//--------------------------------------------------------------------
void clitk::ExtractMediastinumGenericFilter<ArgsInfoType>::UpdateWithInputImageType()
{
// Reading input
- typename ImageType::Pointer patient = this->template GetInput<ImageType>(0);
- typename ImageType::Pointer lung = this->template GetInput<ImageType>(1);
- typename ImageType::Pointer bones = this->template GetInput<ImageType>(2);
+ typename ImageType::Pointer input = this->template GetInput<ImageType>(0);
// Create filter
typedef clitk::ExtractMediastinumFilter<ImageType> FilterType;
typename FilterType::Pointer filter = FilterType::New();
// Set global Options
- filter->SetInputPatientLabelImage(patient, mArgsInfo.patientBG_arg);
- filter->SetInputLungLabelImage(lung, mArgsInfo.lungBG_arg, mArgsInfo.lungRight_arg, mArgsInfo.lungLeft_arg);
- filter->SetInputBonesLabelImage(bones, mArgsInfo.bonesBG_arg);
- filter->SetArgsInfo(mArgsInfo);
+ filter->SetInput(input);
+ SetOptionsFromArgsInfoToFilter<FilterType>(filter);
// Go !
filter->Update();
-
- // Check if error
- if (filter->HasError()) {
- SetLastError(filter->GetLastError());
- // No output
- return;
- }
// Write/Save results
- typename ImageType::Pointer output = filter->GetOutput();
- this->template SetNextOutput<ImageType>(output);
+ typename FilterType::MaskImageType::Pointer output = filter->GetOutput();
+ this->template SetNextOutput<typename FilterType::MaskImageType>(output);
}
//--------------------------------------------------------------------