X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;ds=inline;f=common%2FclitkImageToImageGenericFilterBase.cxx;h=12781e77c9671dbbb503720ac81bd168dc483e64;hb=9eefc9caddf768669a85880cb3bc91c104d3d529;hp=fb61bbfb7b93fbd3459c821eff2edfa508413a71;hpb=decc1d09983198c5b2f1cc1a14e0716fea452f39;p=clitk.git diff --git a/common/clitkImageToImageGenericFilterBase.cxx b/common/clitkImageToImageGenericFilterBase.cxx index fb61bbf..12781e7 100644 --- a/common/clitkImageToImageGenericFilterBase.cxx +++ b/common/clitkImageToImageGenericFilterBase.cxx @@ -1,31 +1,20 @@ /*========================================================================= + Program: vv http://www.creatis.insa-lyon.fr/rio/vv - Program: vv - Module: $RCSfile: clitkImageToImageGenericFilterBase.cxx,v $ - Language: C++ - Date: $Date: 2010/03/02 13:02:52 $ - Version: $Revision: 1.1 $ - Author : Joel Schaerer - David Sarrut + 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 - Copyright (C) 2008 - Léon Bérard cancer center http://oncora1.lyon.fnclcc.fr - CREATIS-LRMN http://www.creatis.insa-lyon.fr + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the copyright notices for more information. - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, version 3 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - - =========================================================================*/ + It is distributed under dual licence + - BSD See included LICENSE.txt file + - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html +======================================================================-====*/ #include "clitkImageToImageGenericFilterBase.h" #include @@ -39,6 +28,7 @@ clitk::ImageToImageGenericFilterBase::ImageToImageGenericFilterBase(std::string :mIOVerbose(false) { mFilterName = n; mFailOnImageTypeError = true; + mReadOnDisk = true; } //-------------------------------------------------------------------- @@ -50,6 +40,13 @@ void clitk::ImageToImageGenericFilterBase::SetInputFilenames(const std::vector f; @@ -104,21 +101,20 @@ std::string clitk::ImageToImageGenericFilterBase::GetOutputFilename() void clitk::ImageToImageGenericFilterBase::GetInputImageDimensionAndPixelType(unsigned int& dim, \ std::string& pixeltype,unsigned int& components) { - if (mInputFilenames.size()) - { - int comp_temp,dim_temp; //clitkCommonImage takes ints - ReadImageDimensionAndPixelType(mInputFilenames[0], dim_temp, pixeltype,comp_temp); - components=comp_temp; dim=dim_temp; - } - else if (mInputVVImages.size()) - { + if (mReadOnDisk && mInputFilenames.size()) { + int comp_temp,dim_temp; //clitkCommonImage takes ints + ReadImageDimensionAndPixelType(mInputFilenames[0], dim_temp, pixeltype,comp_temp); + components=comp_temp; dim=dim_temp; + } + else { + if (mInputVVImages.size()) { pixeltype=mInputVVImages[0]->GetScalarTypeAsString(); dim=mInputVVImages[0]->GetNumberOfDimensions(); components=mInputVVImages[0]->GetNumberOfScalarComponents(); } - else + else assert(false); //No input image, shouldn't happen - + } if (mIOVerbose) { std::cout << "Input is " << mDim << "D " << mPixelTypeName << "." << std::endl; } @@ -280,16 +276,18 @@ void clitk::ImageToImageGenericFilterBase::SetNextOutput(typename ImageType::Poi //-------------------------------------------------------------------- template typename ImageType::Pointer clitk::ImageToImageGenericFilterBase::GetInput(unsigned int n) { - if (mInputFilenames.size() > n) { + if (mReadOnDisk && mInputFilenames.size() > n) { return clitk::readImage(mInputFilenames[n], mIOVerbose); } - else if (mInputVVImages.size() > n) - return typename ImageType::Pointer(const_cast(vvImageToITK(mInputVVImages[n]).GetPointer())); - else - { - assert(false); //No input, this shouldn't happen - return typename ImageType::Pointer(NULL); - } + else { + if (mInputVVImages.size() > n) + return typename ImageType::Pointer(const_cast(vvImageToITK(mInputVVImages[n]).GetPointer())); + else + { + assert(false); //No input, this shouldn't happen + return typename ImageType::Pointer(NULL); + } + } } //--------------------------------------------------------------------