From 5bea196497686f70796822951af654373cba9f97 Mon Sep 17 00:00:00 2001 From: David Sarrut Date: Wed, 26 Jun 2013 16:46:51 +0200 Subject: [PATCH] Allow to convert/write uint image (dose from eclipse) --- common/vvImageWriter.txx | 2 ++ tools/clitkDicom2Image.cxx | 17 ++++++++++------- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/common/vvImageWriter.txx b/common/vvImageWriter.txx index 0705197..81e45ee 100644 --- a/common/vvImageWriter.txx +++ b/common/vvImageWriter.txx @@ -38,6 +38,8 @@ void vvImageWriter::UpdateWithDim(std::string OutputPixelType) UpdateWithDimAndOutputPixelType(); } else if (OutputPixelType == "int") { UpdateWithDimAndOutputPixelType(); + } else if (OutputPixelType == "unsigned_int") { + UpdateWithDimAndOutputPixelType(); } else if (OutputPixelType == "double") { UpdateWithDimAndOutputPixelType(); } else if (OutputPixelType == "float") { diff --git a/tools/clitkDicom2Image.cxx b/tools/clitkDicom2Image.cxx index c7b2e23..6f36bc0 100644 --- a/tools/clitkDicom2Image.cxx +++ b/tools/clitkDicom2Image.cxx @@ -82,12 +82,13 @@ int main(int argc, char * argv[]) gdcm::Attribute<0x28, 0x100> pixel_size; pixel_size.SetFromDataSet(ds); - if (pixel_size.GetValue() != 16) - { - std::cerr << "Pixel type 2 bytes ! " << std::endl; - std::cerr << "In file " << input_files[i] << std::endl; - exit(0); - } + /* if (pixel_size.GetValue() != 16) + { + std::cerr << "Pixel type not 2 bytes ! " << std::endl; + std::cerr << "In file " << input_files[i] << std::endl; + exit(0); + } + */ #else if (args_info.verbose_flag) std::cout << "Not using GDCM-2.x" << std::endl; @@ -107,11 +108,12 @@ int main(int argc, char * argv[]) theorigin[series_number][2] = header->GetZOrigin(); sliceLocations[series_number].push_back(theorigin[series_number][2]); seriesFiles[series_number].push_back(input_files[i]); - if (header->GetPixelSize() != 2) { + /*if (header->GetPixelSize() != 2) { std::cerr << "Pixel type 2 bytes ! " << std::endl; std::cerr << "In file " << input_files[i] << std::endl; exit(0); } + */ #endif } @@ -205,6 +207,7 @@ int main(int argc, char * argv[]) name << *sn << "_" << args_info.output_arg; outfile = name.str(); } + DD("before write"); vvImageWriter::Pointer writer = vvImageWriter::New(); writer->SetInput(image); writer->SetOutputFileName(outfile); -- 2.47.1