From: tbaudier <thomas.baudier@creatis.insa-lyon.fr>
Date: Mon, 15 May 2017 09:27:19 +0000 (+0200)
Subject: Ensure to have correct value
X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=c128aacc440d819036e5595883421ba8df690313;p=clitk.git

Ensure to have correct value
---

diff --git a/tools/clitkImage2DicomSeriesGenericFilter.txx b/tools/clitkImage2DicomSeriesGenericFilter.txx
index 9a87c52..7e11da4 100644
--- a/tools/clitkImage2DicomSeriesGenericFilter.txx
+++ b/tools/clitkImage2DicomSeriesGenericFilter.txx
@@ -46,6 +46,8 @@
  
 #include "itkImageSeriesReader.h"
 #include "itkImageSeriesWriter.h"
+
+#include <itkThresholdImageFilter.h>
  
 #include "itkResampleImageFilter.h"
  
@@ -262,7 +264,21 @@ Image2DicomSeriesGenericFilter<args_info_type>::UpdateWithDimAndPixelType()
       outputSpacing[i] = input->GetSpacing()[i];
       outputSize[i] = input->GetLargestPossibleRegion().GetSize()[i];
     }
- 
+
+////////////////////////////////////////////////
+// 2) Ensure to have value >= -1024
+
+  typedef itk::ThresholdImageFilter <InputImageType> ThresholdImageFilterType;
+  typename ThresholdImageFilterType::Pointer thresholdFilter = ThresholdImageFilterType::New();
+  thresholdFilter->SetInput(input);
+  thresholdFilter->ThresholdBelow(-1024);
+  thresholdFilter->SetOutsideValue(-1024);
+  thresholdFilter->Update();
+
+  input=thresholdFilter->GetOutput();
+
+
+
 ////////////////////////////////////////////////
 // 2) Resample the series
 /*  typename InterpolatorType::Pointer interpolator = InterpolatorType::New();