]> Creatis software - clitk.git/blobdiff - common/clitkImageToImageGenericFilter.cxx
error are now handled by exception
[clitk.git] / common / clitkImageToImageGenericFilter.cxx
index 0428c70c7cc921ad980299c86df1d6b26514a0e1..8561f696dc8821819d1bf51ae43e551efdf48ba0 100644 (file)
+/*=========================================================================
+  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<std::string> & filenames) {
-  mInputFilenames.resize(filenames.size());
-  std::copy(filenames.begin(), filenames.end(), mInputFilenames.begin());
-}
-
-void clitk::ImageToImageGenericFilter::SetInputFilename(const std::string & filename) {
-  std::vector<std::string> 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<std::string> & 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<vvImage::Pointer> 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<vvImage::Pointer> input)
-{
-    mInputVVImages=input;
-}
+// //--------------------------------------------------------------------
+// clitk::ImageToImageGenericFilterBase::ImageToImageGenericFilterBase(std::string n)
+//   :mIOVerbose(false) {
+//   mFilterName = n;
+//   mFailOnImageTypeError = true;
+// }
+// //--------------------------------------------------------------------
+
+
+// //--------------------------------------------------------------------
+// void clitk::ImageToImageGenericFilterBase::SetInputFilenames(const std::vector<std::string> & filenames) {
+//     mInputFilenames=filenames;
+// }
+// //--------------------------------------------------------------------
+
+
+// //--------------------------------------------------------------------
+// void clitk::ImageToImageGenericFilterBase::SetInputFilename(const std::string & filename) {
+//   std::vector<std::string> 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<std::string> & 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<vvImage::Pointer> 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<vvImage::Pointer> 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);
+// }
+// //--------------------------------------------------------------------