From 1bd873d63cf3ae344a481ff4eb64b70434fa129e Mon Sep 17 00:00:00 2001
From: Nicola Vigano <nicola.vigano@esrf.fr>
Date: Thu, 1 Dec 2016 17:43:51 +0100
Subject: [PATCH] 6D-Reconstruction: complain for wrong options!

Signed-off-by: Nicola Vigano <nicola.vigano@esrf.fr>
---
 zUtil_Deformation/Gt6DBlobReconstructor.m | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/zUtil_Deformation/Gt6DBlobReconstructor.m b/zUtil_Deformation/Gt6DBlobReconstructor.m
index 4739600b..fb3f074a 100644
--- a/zUtil_Deformation/Gt6DBlobReconstructor.m
+++ b/zUtil_Deformation/Gt6DBlobReconstructor.m
@@ -42,6 +42,27 @@ classdef Gt6DBlobReconstructor < Gt6DVolumeToBlobProjector
             end
             self = self@Gt6DVolumeToBlobProjector(vols_size, proj_size, blobs_depths, varargin{:});
 
+            possible_tv_norms = {'l12', 'l1', 'ln'};
+            possible_tv_strategies = {'groups', 'volume'};
+            possible_detector_norms = {'KL', 'l2'};
+
+            % Let's complain about wrong options
+            if (~ismember(self.tv_norm, possible_tv_norms))
+                error([mfilename ':wrong_argument'], ...
+                    'TV-norm: %s is not allowed! Use one of [%s] instead', ...
+                    self.tv_norm, sprintf(' "%s"', possible_tv_norms{:}))
+            end
+            if (~ismember(self.tv_strategy, possible_tv_strategies))
+                error([mfilename ':wrong_argument'], ...
+                    'TV-strategy: %s is not allowed! Use one of [%s] instead', ...
+                    self.tv_strategy, sprintf(' "%s"', possible_tv_strategies{:}))
+            end
+            if (~ismember(self.detector_norm, possible_detector_norms))
+                error([mfilename ':wrong_argument'], ...
+                    'Detector-norm: %s is not allowed! Use one of [%s] instead', ...
+                    self.detector_norm, sprintf(' "%s"', possible_detector_norms{:}))
+            end
+
             self.statistics.add_task('cp_dual_update_detector', 'CP Dual variable (detector) update');
             self.statistics.add_task_partial('cp_dual_update_detector', 'cp_dual_detector_FP', 'Forward Projection');
             self.statistics.add_task_partial('cp_dual_update_detector', 'cp_dual_detector_SB', 'Sinograms -> Blobs');
-- 
GitLab