X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=segmentation%2FclitkRelativePositionList.txx;h=e0258d5e71fb560e166c81d1a86a6608c6fe1bcb;hb=5a7da4aedae5c204bc55c187717193e5950f9a44;hp=3ce555993b3d8d9131982517f68f87c01b478d8e;hpb=4824cfde923f5f1d70fbb0e63aaf08886a8fb28d;p=clitk.git diff --git a/segmentation/clitkRelativePositionList.txx b/segmentation/clitkRelativePositionList.txx index 3ce5559..e0258d5 100644 --- a/segmentation/clitkRelativePositionList.txx +++ b/segmentation/clitkRelativePositionList.txx @@ -77,7 +77,6 @@ Read(std::string filename) { if (!is) stop = true; else { std::getline(is, s); - // DD(s); if (s.find("object") != std::string::npos) stop=true; else ss << s << std::endl; if (!is) stop = true; @@ -96,8 +95,9 @@ Read(std::string filename) { ArgsInfoType args_info; std::vector writable(tmpfilename.size() + 1); std::copy(tmpfilename.begin(), tmpfilename.end(), writable.begin()); - char ** argv; - cmdline_parser_clitkRelativePosition2(0, argv, &args_info, 1, 1, 0); + 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; @@ -146,10 +146,13 @@ GenerateOutputInformation() { // Loop on RelativePositionList of operations std::string s = GetInputName(); for(uint i=0; iUpdate(); m_working_input = relPosFilter->GetOutput(); StopCurrentStep(m_working_input); + // clitk::PrintMemory(true, "End"); } } //-------------------------------------------------------------------- @@ -211,9 +215,10 @@ void clitk::RelativePositionList:: SetFilterOptions(typename RelPosFilterType::Pointer filter, ArgsInfoType & options) { - if (options.orientation_given != 1) { - DD("ERRROR DEBUG TODO no more than 1 orientation yet"); - exit(0); + if (options.orientation_given > 1) { + clitkExceptionMacro("Error in the RelPos options. I need a single --orientation (for the moment)." + << " Current options are for obj = '" << options.object_arg + << "', threshold = " << options.threshold_arg << std::endl); } ImagePointer object = GetAFDB()->template GetImage(options.object_arg); @@ -222,8 +227,21 @@ SetFilterOptions(typename RelPosFilterType::Pointer filter, ArgsInfoType & optio filter->SetVerboseImageSizeFlag(GetVerboseImageSizeFlag()); filter->SetFuzzyThreshold(options.threshold_arg); filter->SetInverseOrientationFlag(options.inverse_flag); // MUST BE BEFORE AddOrientationTypeString - for(uint i=0; iAddOrientationTypeString(options.orientation_arg[i]); + + if (options.orientation_given == 1) { + for(uint i=0; iAddOrientationTypeString(options.orientation_arg[i]); + } + else { + if (options.angle1_given && options.angle2_given) { + filter->AddAnglesInDeg(options.angle1_arg, options.angle2_arg); + } + else { + clitkExceptionMacro("Error in the RelPos options. I need --orientation or (--angle1 and --angle2)." + << " Current options are for obj = '" << options.object_arg + << "', threshold = " << options.threshold_arg << std::endl); + } + } filter->SetIntermediateSpacing(options.spacing_arg); if (options.spacing_arg == -1) filter->IntermediateSpacingFlagOff(); else filter->IntermediateSpacingFlagOn();