X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=vv%2FvvImageWriter.txx;h=dc07874888f73b1c4ba64cec75eed8ef6a80eb65;hb=a4c7c3e6b24a06bfe248f935411e0136184faf97;hp=a62578f7d961e9060a8ccdf326bf358ddb7afdcc;hpb=0b7c9b1e1215634b02cbd38d4e4ba101d6111ba8;p=clitk.git diff --git a/vv/vvImageWriter.txx b/vv/vvImageWriter.txx index a62578f..dc07874 100644 --- a/vv/vvImageWriter.txx +++ b/vv/vvImageWriter.txx @@ -1,7 +1,7 @@ /*========================================================================= Program: vv http://www.creatis.insa-lyon.fr/rio/vv - Authors belong to: + Authors belong to: - University of LYON http://www.universite-lyon.fr/ - Léon Bérard cancer center http://oncora1.lyon.fnclcc.fr - CREATIS CNRS laboratory http://www.creatis.insa-lyon.fr @@ -24,42 +24,25 @@ template void vvImageWriter::UpdateWithDim(std::string OutputPixelType) { - if (OutputPixelType == "short") - { - UpdateWithDimAndOutputPixelType(); - } - else if (OutputPixelType == "unsigned short") - { - UpdateWithDimAndOutputPixelType(); - } - else if (OutputPixelType == "unsigned_short") - { - UpdateWithDimAndOutputPixelType(); - } - else if (OutputPixelType == "char") - { - UpdateWithDimAndOutputPixelType(); - } - else if (OutputPixelType == "unsigned_char") - { - UpdateWithDimAndOutputPixelType(); - } - else if (OutputPixelType == "int") - { - UpdateWithDimAndOutputPixelType(); - } - else if (OutputPixelType == "double") - { - UpdateWithDimAndOutputPixelType(); - } - else if (OutputPixelType == "float") - { - UpdateWithDimAndOutputPixelType(); - } - else - { - std::cerr << "Error, output pixel type : \"" << OutputPixelType << "\" unknown !" << std::endl; - } + if (OutputPixelType == "short") { + UpdateWithDimAndOutputPixelType(); + } else if (OutputPixelType == "unsigned short") { + UpdateWithDimAndOutputPixelType(); + } else if (OutputPixelType == "unsigned_short") { + UpdateWithDimAndOutputPixelType(); + } else if (OutputPixelType == "char") { + UpdateWithDimAndOutputPixelType(); + } else if (OutputPixelType == "unsigned_char") { + UpdateWithDimAndOutputPixelType(); + } else if (OutputPixelType == "int") { + UpdateWithDimAndOutputPixelType(); + } else if (OutputPixelType == "double") { + UpdateWithDimAndOutputPixelType(); + } else if (OutputPixelType == "float") { + UpdateWithDimAndOutputPixelType(); + } else { + std::cerr << "Error, output pixel type : \"" << OutputPixelType << "\" unknown !" << std::endl; + } } //==================================================================== @@ -67,26 +50,25 @@ void vvImageWriter::UpdateWithDim(std::string OutputPixelType) template void vvImageWriter::UpdateWithDimAndOutputPixelType() { - //Create the writer - typedef itk::Image< OutputPixelType, VImageDimension > OutputImageType; - typedef itk::ImageFileWriter WriterType; - typename WriterType::Pointer writer = WriterType::New(); - writer->SetFileName(mOutputFilename); - writer->SetInput(vvImageToITK(mImage)); - if (mUseAnObserver) { - writer->AddObserver(itk::ProgressEvent(), mObserver); - } - try { - writer->Update(); - } - catch ( itk::ExceptionObject & err ) { - std::cerr << "Error while reading " << mOutputFilename.c_str() - << " " << err << std::endl; - std::stringstream error; - error << err; - mLastError = error.str(); - return; - } + //Create the writer + typedef itk::Image< OutputPixelType, VImageDimension > OutputImageType; + typedef itk::ImageFileWriter WriterType; + typename WriterType::Pointer writer = WriterType::New(); + writer->SetFileName(mOutputFilename); + writer->SetInput(vvImageToITK(mImage)); + if (mUseAnObserver) { + writer->AddObserver(itk::ProgressEvent(), mObserver); + } + try { + writer->Update(); + } catch ( itk::ExceptionObject & err ) { + std::cerr << "Error while reading " << mOutputFilename.c_str() + << " " << err << std::endl; + std::stringstream error; + error << err; + mLastError = error.str(); + return; + } } //====================================================================