/*=========================================================================
+ 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 <joel.schaerer@creatis.insa-lyon.fr>
- David Sarrut <david.sarrut@creatis.insa-lyon.fr>
+ 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 <http://www.gnu.org/licenses/>.
-
- =========================================================================*/
+ 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 <itkImage.h>
:mIOVerbose(false) {
mFilterName = n;
mFailOnImageTypeError = true;
+ mReadOnDisk = true;
}
//--------------------------------------------------------------------
//--------------------------------------------------------------------
+//--------------------------------------------------------------------
+void clitk::ImageToImageGenericFilterBase::EnableReadOnDisk(bool b) {
+ mReadOnDisk = b;
+}
+//--------------------------------------------------------------------
+
+
//--------------------------------------------------------------------
void clitk::ImageToImageGenericFilterBase::SetInputFilename(const std::string & filename) {
std::vector<std::string> f;
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;
}
//--------------------------------------------------------------------
template<class ImageType>
typename ImageType::Pointer clitk::ImageToImageGenericFilterBase::GetInput(unsigned int n) {
- if (mInputFilenames.size() > n) {
+ if (mReadOnDisk && mInputFilenames.size() > n) {
return clitk::readImage<ImageType>(mInputFilenames[n], mIOVerbose);
}
- else if (mInputVVImages.size() > n)
- return typename ImageType::Pointer(const_cast<ImageType*>(vvImageToITK<ImageType>(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<ImageType*>(vvImageToITK<ImageType>(mInputVVImages[n]).GetPointer()));
+ else
+ {
+ assert(false); //No input, this shouldn't happen
+ return typename ImageType::Pointer(NULL);
+ }
+ }
}
//--------------------------------------------------------------------