From 01d304e57910a247ec738631ba07ff93fd2ad2eb Mon Sep 17 00:00:00 2001 From: tbaudier Date: Fri, 8 Mar 2019 10:59:13 +0100 Subject: [PATCH] Add output dicom filename to clitkImage2Dicom With -o option, the result is stored into the folder defined by -o, we cannot add a prefix filename The -n option add this prefix filename --- tools/clitkImage2Dicom.ggo | 3 ++- tools/clitkImage2DicomGenericFilter.txx | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/tools/clitkImage2Dicom.ggo b/tools/clitkImage2Dicom.ggo index d790cbf..47ee878 100644 --- a/tools/clitkImage2Dicom.ggo +++ b/tools/clitkImage2Dicom.ggo @@ -8,5 +8,6 @@ option "verbose" v "Verbose" flag off option "input" i "Input image filename" string no option "inputDcm" d "Input dicom filename" string no -option "outputDcm" o "Output dicom filename" string no +option "outputDcm" o "Output dicom folder" string no +option "nameDicom" n "Output dicom filename" string no diff --git a/tools/clitkImage2DicomGenericFilter.txx b/tools/clitkImage2DicomGenericFilter.txx index c58bd2f..da30589 100644 --- a/tools/clitkImage2DicomGenericFilter.txx +++ b/tools/clitkImage2DicomGenericFilter.txx @@ -374,7 +374,10 @@ Image2DicomGenericFilter::UpdateWithDimAndPixelType() // Generate the file names OutputNamesGeneratorType::Pointer outputNames = OutputNamesGeneratorType::New(); std::string seriesFormat(m_ArgsInfo.outputDcm_arg); - seriesFormat = seriesFormat + "/" + "IM%d.dcm"; + seriesFormat = seriesFormat + "/"; + if (m_ArgsInfo.nameDicom_given) + seriesFormat = seriesFormat + m_ArgsInfo.nameDicom_arg + "_"; + seriesFormat = seriesFormat + "IM%d.dcm"; outputNames->SetSeriesFormat(seriesFormat.c_str()); outputNames->SetStartIndex(1); outputNames->SetEndIndex(outputSize[2]); -- 2.47.1