#include "itkMacro.h"
#include <itkContinuousIndex.h>
+#include <itkImageRegionConstIterator.h>
+#include <itkImageRegionIterator.h>
//--------------------------------------------------------------------
namespace clitk {
#define DD(a) std::cout << #a " = [ " << a << " ]" << std::endl;
#define DDV(a,n) { std::cout << #a " = [ "; for(unsigned int _i_=0; _i_<n; _i_++) { std::cout << a[_i_] << " "; }; std::cout << " ]" << std::endl;}
+ //--------------------------------------------------------------------
+ // when everything goes wrong
+#define WHEREAMI "[ " << __FILE__ << " ] line " << __LINE__
+#define FATAL(a) std::cerr << "ERROR in " << WHEREAMI << ": " << a; exit(0);
+
//--------------------------------------------------------------------
// GGO with modified struct name
#define GGO(ggo_filename, args_info) \
//--------------------------------------------------------------------
void disableStdCerr();
void enableStdCerr();
-
+
+ //--------------------------------------------------------------------
+ template<class ImageType>
+ void CloneImage(const typename ImageType::Pointer & input, typename ImageType::Pointer & output);
+
#include "clitkCommon.txx"
} // end namespace
}
//--------------------------------------------------------------------
+//--------------------------------------------------------------------
+template<class ImageType>
+void CloneImage(const typename ImageType::Pointer & input, typename ImageType::Pointer & output) {
+ output->SetRegions(input->GetLargestPossibleRegion());
+ output->SetSpacing(input->GetSpacing());
+ output->Allocate();
+ typedef itk::ImageRegionConstIterator<ImageType> ConstIteratorType;
+ ConstIteratorType pi(input,input->GetLargestPossibleRegion());
+ pi.GoToBegin();
+ typedef itk::ImageRegionIterator<ImageType> IteratorType;
+ IteratorType po(output,input->GetLargestPossibleRegion());
+ po.GoToBegin();
+ while (!pi.IsAtEnd()) {
+ po.Set(pi.Get());
+ ++pi;
+ ++po;
+ }
+}
+//--------------------------------------------------------------------
+
#endif /* end #define CLITKCOMMON_TXX */