X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=segmentation%2FclitkRelativePositionList.txx;h=39cc272cd1156253b4578efa45b30f1a0789d0b0;hb=01d3c1060300fd0f117709f6c2e5d39d16781c2f;hp=7a53a99dc1eb3248c230b6690ef346b0906003be;hpb=1d616cc7be31f7195c8bba4142e02350cd2fb958;p=clitk.git diff --git a/segmentation/clitkRelativePositionList.txx b/segmentation/clitkRelativePositionList.txx index 7a53a99..39cc272 100644 --- a/segmentation/clitkRelativePositionList.txx +++ b/segmentation/clitkRelativePositionList.txx @@ -16,11 +16,24 @@ - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html ======================================================================-====*/ +#include "clitkLabelImageOverlapMeasureFilter.h" //-------------------------------------------------------------------- template clitk::RelativePositionList:: RelativePositionList() { + ComputeOverlapFlagOff(); +} +//-------------------------------------------------------------------- + + +//-------------------------------------------------------------------- +template +void +clitk::RelativePositionList:: +SetReferenceImageForOverlapMeasure(ImagePointer ref) { + m_reference = ref; + ComputeOverlapFlagOn(); } //-------------------------------------------------------------------- @@ -87,6 +100,8 @@ Read(std::string filename) { std::ofstream os; openFileForWriting(os, tmpfilename); os << text; + os << "input = nothing" << std::endl; + os << "output = nothing" << std::endl; os.close(); // Create a struct to store options. I use two step to allow to @@ -97,14 +112,11 @@ Read(std::string filename) { std::copy(tmpfilename.begin(), tmpfilename.end(), writable.begin()); char ** argv = new char*[1]; argv[0] = new char[1]; - cmdline_parser_clitkRelativePosition2(1, argv, &args_info, 1, 1, 0); - args_info.input_given = 1; - args_info.input_arg = new char[1]; - args_info.output_given = 1; - args_info.output_arg = new char[1]; - cmdline_parser_clitkRelativePosition_configfile(&writable[0], &args_info, 0, 0, 1); - - // Store the args + struct cmdline_parser_clitkRelativePosition_params params; + params.override = 0; + params.initialize = 1; + params.check_required = 0; + cmdline_parser_clitkRelativePosition_configfile(&writable[0], &args_info, 1, 1, 1); mArgsInfoList.push_back(args_info); // Delete the temporary file @@ -146,16 +158,18 @@ GenerateOutputInformation() { // Loop on RelativePositionList of operations std::string s = GetInputName(); for(uint i=0; iUpdate(); m_working_input = relPosFilter->GetOutput(); StopCurrentStep(m_working_input); + + // Compute overlap with reference if needed + if (GetComputeOverlapFlag()) { + typedef clitk::LabelImageOverlapMeasureFilter FilterType; + typename FilterType::Pointer filter = FilterType::New(); + filter->SetInput(0, m_working_input); + filter->SetInput(1, m_reference); + filter->Update(); + } + } } //--------------------------------------------------------------------