From: David Sarrut Date: Thu, 20 Jun 2013 10:30:03 +0000 (+0200) Subject: Allow to write only new structures (do not copy older ones) X-Git-Tag: v1.4.0~201 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=593ad2d23114d3ff50817a224e766a8cce624c78;p=clitk.git Allow to write only new structures (do not copy older ones) --- diff --git a/common/clitkImage2DicomRTStructFilter.h b/common/clitkImage2DicomRTStructFilter.h index d570934..b6a74b2 100644 --- a/common/clitkImage2DicomRTStructFilter.h +++ b/common/clitkImage2DicomRTStructFilter.h @@ -47,6 +47,7 @@ namespace clitk { itkSetMacro(OutputFilename, std::string); void SetROIType(std::string type); itkSetMacro(ThresholdValue, PixelType); + itkSetMacro(SkipInitialStructuresFlag, bool); // Run filter void Update(); @@ -58,6 +59,7 @@ namespace clitk { std::string m_ROIType; PixelType m_ThresholdValue; std::vector m_InputFilenames; + bool m_SkipInitialStructuresFlag; }; //-------------------------------------------------------------------- diff --git a/common/clitkImage2DicomRTStructFilter.txx b/common/clitkImage2DicomRTStructFilter.txx index 248451d..77c5e07 100644 --- a/common/clitkImage2DicomRTStructFilter.txx +++ b/common/clitkImage2DicomRTStructFilter.txx @@ -62,6 +62,7 @@ clitk::Image2DicomRTStructFilter::Image2DicomRTStructFilter() m_DicomFolder = ""; m_OutputFilename = "default-output.dcm"; m_ThresholdValue = 0.5; + m_SkipInitialStructuresFlag = false; } //-------------------------------------------------------------------- @@ -119,6 +120,11 @@ void clitk::Image2DicomRTStructFilter::Update() // Init writer vtkGDCMPolyDataWriter * writer = vtkGDCMPolyDataWriter::New(); int numMasks = reader->GetNumberOfOutputPorts() + m; + + if (m_SkipInitialStructuresFlag) { + numMasks = m; + } + writer->SetNumberOfInputPorts(numMasks); writer->SetFileName(m_OutputFilename.c_str()); writer->SetMedicalImageProperties(reader->GetMedicalImageProperties()); diff --git a/tools/clitkImage2DicomRTStruct.cxx b/tools/clitkImage2DicomRTStruct.cxx index a82b0ec..807b073 100644 --- a/tools/clitkImage2DicomRTStruct.cxx +++ b/tools/clitkImage2DicomRTStruct.cxx @@ -42,6 +42,7 @@ int main(int argc, char * argv[]) { filter.SetOutputFilename(args_info.output_arg); filter.SetROIType(args_info.roitype_arg); filter.SetThresholdValue(args_info.threshold_arg); + filter.SetSkipInitialStructuresFlag(args_info.skip_flag); filter.Update(); // This is the end my friend diff --git a/tools/clitkImage2DicomRTStruct.ggo b/tools/clitkImage2DicomRTStruct.ggo index 70f85b2..7416d32 100644 --- a/tools/clitkImage2DicomRTStruct.ggo +++ b/tools/clitkImage2DicomRTStruct.ggo @@ -11,5 +11,6 @@ option "dicom" d "Input folder where the initial dicom ct is" option "output" o "Output DicomRT filename" string yes option "threshold" t "Threshold for binary image" float no default = "0.5" +option "skip" s "Do not write in output the structures that was in input" flag off option "roitype" - "Name of the type of roi added into the rt-struct" string no default = "ORGAN"