X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=common%2FclitkImageToImageGenericFilter.cxx;h=8561f696dc8821819d1bf51ae43e551efdf48ba0;hb=c05b40d385ba67a91c43f9396718f738e191c0e4;hp=0428c70c7cc921ad980299c86df1d6b26514a0e1;hpb=931a42358442f4ee4f314613c991c838d4b4e3b7;p=clitk.git diff --git a/common/clitkImageToImageGenericFilter.cxx b/common/clitkImageToImageGenericFilter.cxx index 0428c70..8561f69 100644 --- a/common/clitkImageToImageGenericFilter.cxx +++ b/common/clitkImageToImageGenericFilter.cxx @@ -1,90 +1,180 @@ +/*========================================================================= + Program: vv http://www.creatis.insa-lyon.fr/rio/vv + + 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 + + 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. + + 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 "clitkImageToImageGenericFilter.h" #include "clitkImageCommon.h" -//-------------------------------------------------------------------- -clitk::ImageToImageGenericFilter::ImageToImageGenericFilter() : - mIOVerbose(false) -{} -//-------------------------------------------------------------------- - -//-------------------------------------------------------------------- -void clitk::ImageToImageGenericFilter::SetInputFilenames(const std::vector & filenames) { - mInputFilenames.resize(filenames.size()); - std::copy(filenames.begin(), filenames.end(), mInputFilenames.begin()); -} - -void clitk::ImageToImageGenericFilter::SetInputFilename(const std::string & filename) { - std::vector f; - f.push_back(filename); - SetInputFilenames(f); -} - -void clitk::ImageToImageGenericFilter::AddInputFilename(const std::string & filename) { - mInputFilenames.push_back(filename); -} -//-------------------------------------------------------------------- - -//-------------------------------------------------------------------- -void clitk::ImageToImageGenericFilter::SetOutputFilename(const std::string & filename) { - mOutputFilenames.clear(); - mOutputFilenames.push_back(filename); -} -void clitk::ImageToImageGenericFilter::AddOutputFilename(const std::string & filename) -{ - mOutputFilenames.push_back(filename); -} -void clitk::ImageToImageGenericFilter::SetOutputFilenames(const std::vector & filenames) -{ - std::copy(filenames.begin(), filenames.end(), mOutputFilenames.begin()); -} -std::string clitk::ImageToImageGenericFilter::GetOutputFilename() -{ - assert(mOutputFilenames.size() == 1); - return mOutputFilenames.front(); -} -//-------------------------------------------------------------------- -void clitk::ImageToImageGenericFilter::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()) - { - pixeltype=mInputVVImages[0]->GetScalarTypeAsString(); - dim=mInputVVImages[0]->GetNumberOfDimensions(); - components=mInputVVImages[0]->GetNumberOfScalarComponents(); - } - else - assert(false); //No input image, shouldn't happen -} -vvImage::Pointer clitk::ImageToImageGenericFilter::GetOutputVVImage () -{ - assert(mOutputVVImages.size()); - return mOutputVVImages[0]; -} - -std::vector clitk::ImageToImageGenericFilter::GetOutputVVImages() -{ - return mOutputVVImages; -} - -void clitk::ImageToImageGenericFilter::SetInputVVImage (vvImage::Pointer input) -{ - mInputVVImages.clear(); - mInputVVImages.push_back(input); -} - -void clitk::ImageToImageGenericFilter::AddInputVVImage (vvImage::Pointer input) -{ - mInputVVImages.push_back(input); -} - -void clitk::ImageToImageGenericFilter::SetInputVVImages (std::vector input) -{ - mInputVVImages=input; -} +// //-------------------------------------------------------------------- +// clitk::ImageToImageGenericFilterBase::ImageToImageGenericFilterBase(std::string n) +// :mIOVerbose(false) { +// mFilterName = n; +// mFailOnImageTypeError = true; +// } +// //-------------------------------------------------------------------- + + +// //-------------------------------------------------------------------- +// void clitk::ImageToImageGenericFilterBase::SetInputFilenames(const std::vector & filenames) { +// mInputFilenames=filenames; +// } +// //-------------------------------------------------------------------- + + +// //-------------------------------------------------------------------- +// void clitk::ImageToImageGenericFilterBase::SetInputFilename(const std::string & filename) { +// std::vector f; +// f.push_back(filename); +// SetInputFilenames(f); +// } +// //-------------------------------------------------------------------- + + +// //-------------------------------------------------------------------- +// void clitk::ImageToImageGenericFilterBase::AddInputFilename(const std::string & filename) { +// mInputFilenames.push_back(filename); +// } +// //-------------------------------------------------------------------- + + +// //-------------------------------------------------------------------- +// void clitk::ImageToImageGenericFilterBase::SetOutputFilename(const std::string & filename) { +// mOutputFilenames.clear(); +// mOutputFilenames.push_back(filename); +// } +// //-------------------------------------------------------------------- + + +// //-------------------------------------------------------------------- +// void clitk::ImageToImageGenericFilterBase::AddOutputFilename(const std::string & filename) +// { +// mOutputFilenames.push_back(filename); +// } +// //-------------------------------------------------------------------- + + +// //-------------------------------------------------------------------- +// void clitk::ImageToImageGenericFilterBase::SetOutputFilenames(const std::vector & filenames) +// { +// mOutputFilenames.clear(); +// std::copy(filenames.begin(),filenames.end(),mOutputFilenames.begin()); +// } +// //-------------------------------------------------------------------- + + +// //-------------------------------------------------------------------- +// std::string clitk::ImageToImageGenericFilterBase::GetOutputFilename() +// { +// assert(mOutputFilenames.size() == 1); +// return mOutputFilenames.front(); +// } +// //-------------------------------------------------------------------- + + +// //-------------------------------------------------------------------- +// 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()) +// { +// pixeltype=mInputVVImages[0]->GetScalarTypeAsString(); +// dim=mInputVVImages[0]->GetNumberOfDimensions(); +// components=mInputVVImages[0]->GetNumberOfScalarComponents(); +// } +// else +// assert(false); //No input image, shouldn't happen + +// if (mIOVerbose) { +// std::cout << "Input is " << mDim << "D " << mPixelTypeName << "." << std::endl; +// } +// } +// //-------------------------------------------------------------------- + + +// //-------------------------------------------------------------------- +// vvImage::Pointer clitk::ImageToImageGenericFilterBase::GetOutputVVImage () +// { +// assert(mOutputVVImages.size()); +// return mOutputVVImages[0]; +// } +// //-------------------------------------------------------------------- + + +// //-------------------------------------------------------------------- +// std::vector clitk::ImageToImageGenericFilterBase::GetOutputVVImages() +// { +// return mOutputVVImages; +// } +// //-------------------------------------------------------------------- + + +// //-------------------------------------------------------------------- +// void clitk::ImageToImageGenericFilterBase::SetInputVVImage (vvImage::Pointer input) +// { +// mInputVVImages.clear(); +// mInputVVImages.push_back(input); +// } +// //-------------------------------------------------------------------- + + +// //-------------------------------------------------------------------- +// void clitk::ImageToImageGenericFilterBase::AddInputVVImage (vvImage::Pointer input) +// { +// mInputVVImages.push_back(input); +// } +// //-------------------------------------------------------------------- + + +// //-------------------------------------------------------------------- +// void clitk::ImageToImageGenericFilterBase::SetInputVVImages (std::vector input) +// { +// mInputVVImages=input; +// } +// //-------------------------------------------------------------------- + + +// //-------------------------------------------------------------------- +// void clitk::ImageToImageGenericFilterBase::PrintAvailableImageTypes() { +// std::cout << GetAvailableImageTypes(); +// } +// //-------------------------------------------------------------------- + + + +// //-------------------------------------------------------------------- +// void clitk::ImageToImageGenericFilterBase::ImageTypeError() { +// std::cerr << "**Error** The filter <" << mFilterName << "> is not available for " +// << mDim << "D images with pixel=" +// << mPixelTypeName << " and " +// << mNbOfComponents << " component." << std::endl; +// std::cerr << GetAvailableImageTypes(); +// exit(0); +// } +// //-------------------------------------------------------------------- + +// //-------------------------------------------------------------------- +// void clitk::ImageToImageGenericFilterBase::SetImageTypeError() { +// std::cerr << "TODO ! " << std::endl; +// exit(0); +// } +// //--------------------------------------------------------------------