]> Creatis software - clitk.git/blobdiff - filters/clitkImageConvertGenericFilter.cxx
Reformatted using new coding style
[clitk.git] / filters / clitkImageConvertGenericFilter.cxx
index c6afba85cb7cb0c6b97129f4baade53a17b7e431..944ec8cf8eaec2400f0af676877b18a6a28076d5 100644 (file)
@@ -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
 
 //--------------------------------------------------------------------
 clitk::ImageConvertGenericFilter::ImageConvertGenericFilter():
-  clitk::ImageToImageGenericFilter<Self>("ImageConvert") {
+  clitk::ImageToImageGenericFilter<Self>("ImageConvert")
+{
   mOutputPixelTypeName = "NotSpecified";
   mWarningOccur = false;
   mWarning = "";
   mDisplayWarning = true;
   InitializeImageType<2>();
-  InitializeImageType<3>();  
-  InitializeImageType<4>();  
+  InitializeImageType<3>();
+  InitializeImageType<4>();
 }
 //--------------------------------------------------------------------
 
 
 //--------------------------------------------------------------------
 template<unsigned int Dim>
-void clitk::ImageConvertGenericFilter::InitializeImageType() {      
-    ADD_DEFAULT_IMAGE_TYPES(Dim);
+void clitk::ImageConvertGenericFilter::InitializeImageType()
+{
+  ADD_DEFAULT_IMAGE_TYPES(Dim);
 }
 //--------------------------------------------------------------------
 
 
 //--------------------------------------------------------------------
 template<class InputImageType>
-void clitk::ImageConvertGenericFilter::UpdateWithInputImageType() {
+void clitk::ImageConvertGenericFilter::UpdateWithInputImageType()
+{
 
   // Verbose stuff
   if (mIOVerbose) {
@@ -53,13 +56,12 @@ void clitk::ImageConvertGenericFilter::UpdateWithInputImageType() {
       itk::ImageIOBase::Pointer header = clitk::readImageHeader(mInputFilenames[0]);
       printImageHeader(header, std::cout);
       std::cout << std::endl;
-    }
-    else {
+    } else {
       for(unsigned int i=0; i<mInputFilenames.size(); i++) {
-       std::cout << "Input image " << i << " <" << mInputFilenames[i] << "> is ";
-       itk::ImageIOBase::Pointer h = clitk::readImageHeader(mInputFilenames[i]);       
-       printImageHeader(h, std::cout);
-       std::cout << std::endl;
+        std::cout << "Input image " << i << " <" << mInputFilenames[i] << "> is ";
+        itk::ImageIOBase::Pointer h = clitk::readImageHeader(mInputFilenames[i]);
+        printImageHeader(h, std::cout);
+        std::cout << std::endl;
       }
     }
   }
@@ -70,8 +72,7 @@ void clitk::ImageConvertGenericFilter::UpdateWithInputImageType() {
     typename InputImageType::Pointer input = this->template GetInput<InputImageType>(0);
     //clitk::writeImage<InputImageType>(input, mOutputFilename, mIOVerbose);
     this->SetNextOutput<InputImageType>(input);
-  }
-  else {
+  } else {
 #define TRY_TYPE(TYPE)                                                 \
     if (IsSameType<TYPE>(mOutputPixelTypeName)) { UpdateWithOutputType<InputImageType, TYPE>(); return; }
     TRY_TYPE(char);
@@ -85,16 +86,17 @@ void clitk::ImageConvertGenericFilter::UpdateWithInputImageType() {
 #undef TRY_TYPE
 
     std::string list = CreateListOfTypes<char, uchar, short, ushort, int, float, double>();
-    std::cerr << "Error, I don't know the output type '" << mOutputPixelTypeName 
-             << "'. " << std::endl << "Known types are " << list << "." << std::endl;
+    std::cerr << "Error, I don't know the output type '" << mOutputPixelTypeName
+              << "'. " << std::endl << "Known types are " << list << "." << std::endl;
     exit(0);
-  }  
+  }
 }
 //====================================================================
 
 //====================================================================
 template<class InputImageType, class OutputPixelType>
-void clitk::ImageConvertGenericFilter::UpdateWithOutputType() {
+void clitk::ImageConvertGenericFilter::UpdateWithOutputType()
+{
   // Read
   typename InputImageType::Pointer input =this->template GetInput<InputImageType>(0);
 
@@ -105,15 +107,15 @@ void clitk::ImageConvertGenericFilter::UpdateWithOutputType() {
   std::ostringstream osstream;
   if (std::numeric_limits<PixelType>::is_signed) {
     if (!std::numeric_limits<OutputPixelType>::is_signed) {
-      osstream << "Warning, input type is signed (" << mPixelTypeName << ") while output type is not (" 
-              << mOutputPixelTypeName << "), use at your own responsability." << std::endl;
-      mWarningOccur = true;      
+      osstream << "Warning, input type is signed (" << mPixelTypeName << ") while output type is not ("
+               << mOutputPixelTypeName << "), use at your own responsability." << std::endl;
+      mWarningOccur = true;
     }
   }
   if (!std::numeric_limits<PixelType>::is_integer) {
     if (std::numeric_limits<OutputPixelType>::is_integer) {
-      osstream << "Warning, input type is not integer (" << mPixelTypeName << ") while output type is (" 
-              << mOutputPixelTypeName << "), use at your own responsability." << std::endl;
+      osstream << "Warning, input type is not integer (" << mPixelTypeName << ") while output type is ("
+               << mOutputPixelTypeName << "), use at your own responsability." << std::endl;
       mWarningOccur = true;
     }
   }
@@ -121,14 +123,14 @@ void clitk::ImageConvertGenericFilter::UpdateWithOutputType() {
   // DD(std::numeric_limits<OutputPixelType>::digits10);
   if (!std::numeric_limits<PixelType>::is_integer) {
     if (std::numeric_limits<OutputPixelType>::is_integer) {
-      osstream << "Warning, input type is not integer (" << mPixelTypeName << ") while output type is (" 
-              << mOutputPixelTypeName << "), use at your own responsability." << std::endl;
+      osstream << "Warning, input type is not integer (" << mPixelTypeName << ") while output type is ("
+               << mOutputPixelTypeName << "), use at your own responsability." << std::endl;
       mWarningOccur = true;
     }
   }
   if (std::numeric_limits<PixelType>::digits10 > std::numeric_limits<OutputPixelType>::digits10) {
-    osstream << "Warning, possible loss of precision : input type is (" << mPixelTypeName << ") while output type is (" 
-            << mOutputPixelTypeName << "), use at your own responsability." << std::endl;
+    osstream << "Warning, possible loss of precision : input type is (" << mPixelTypeName << ") while output type is ("
+             << mOutputPixelTypeName << "), use at your own responsability." << std::endl;
     mWarningOccur = true;
   }