X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=tools%2FclitkImageConvertGenericFilter.h;h=4f1a10031db0123b4ec7295f0ae19b6fe7dd98f5;hb=5f801bf0b07486889123e941d6913d4369dfc86f;hp=8ffb360596833d0225c6b022cc9dd04711dc544d;hpb=22e282cf465b7f07cd17c4d615d726b079b84058;p=clitk.git diff --git a/tools/clitkImageConvertGenericFilter.h b/tools/clitkImageConvertGenericFilter.h index 8ffb360..4f1a100 100644 --- a/tools/clitkImageConvertGenericFilter.h +++ b/tools/clitkImageConvertGenericFilter.h @@ -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://www.centreleonberard.fr - CREATIS CNRS laboratory http://www.creatis.insa-lyon.fr @@ -23,7 +23,7 @@ * @author David Sarrut * @date 05 May 2008 10:40:24 - * @brief + * @brief ===================================================================*/ @@ -36,7 +36,7 @@ namespace clitk { - + template class ImageConvertTraits { @@ -47,17 +47,17 @@ namespace clitk { } }; - template < class TPixel, unsigned int Comp > - class ImageConvertTraits< itk::Vector > - { - public: - enum { IS_VECTOR = true }; + template < class TPixel, unsigned int Comp > + class ImageConvertTraits< itk::Vector > + { + public: + enum { IS_VECTOR = true }; }; - class ImageConvertGenericFilter: + class ImageConvertGenericFilter: public clitk::ImageToImageGenericFilter { - - public: + + public: // constructor - destructor ImageConvertGenericFilter(); @@ -68,24 +68,26 @@ namespace clitk { // New itkNewMacro(Self); - + // Members functions std::string GetInputPixelTypeName() { return m_PixelTypeName; } std::string GetOutputPixelTypeName() { return mOutputPixelTypeName; } void SetOutputPixelType(std::string p) { mOutputPixelTypeName = p; } void SetVV(bool b) { mVV = b; } + void SetNoNiiMeta(bool b) { mNoNiiMeta = b; } bool IsWarningOccur() { return mWarningOccur; } std::string & GetWarning() { return mWarning; } void EnableDisplayWarning(bool b) { mDisplayWarning = b; } + void SetCorrectNegativeSpacingFlag(bool b) { mCorrectNegativeSpacingFlag = b; } //-------------------------------------------------------------------- // Main function called each time the filter is updated - template + template void UpdateWithInputImageType(); template void CheckTypes(std::string inType, std::string outType); - + protected: template void InitializeImageType(); @@ -94,6 +96,8 @@ namespace clitk { bool mWarningOccur; bool mDisplayWarning; bool mVV; + bool mNoNiiMeta; + bool mCorrectNegativeSpacingFlag; private: template @@ -119,17 +123,17 @@ namespace clitk { else { std::string list = CreateListOfTypes(); - std::cerr << "Error, I don't know the vector output type '" << outputPixelType + std::cerr << "Error, I don't know the vector output type '" << outputPixelType << "'. " << std::endl << "Known types are " << list << "." << std::endl; return false; } - + return true; } private: - - template + + template static void UpdateWithOutputType(ImageConvertGenericFilter& filter) { // Read @@ -152,7 +156,7 @@ namespace clitk { filter.SetNextOutput(cast_filter->GetOutput()); } }; - + template class UpdateWithSelectiveOutputType { @@ -160,7 +164,7 @@ namespace clitk { static bool Run(ImageConvertGenericFilter& filter, std::string outputPixelType) { /* - // RP: future conversions? + // RP: future conversions? if (IsSameType(outputPixelType)) UpdateWithOutputVectorType(); else if (IsSameType(outputPixelType)) @@ -171,7 +175,7 @@ namespace clitk { UpdateWithOutputVectorType(); else if (IsSameType(outputPixelType)) UpdateWithOutputVectorType(); - else + else */ if (IsSameType(outputPixelType)) UpdateWithOutputVectorType(filter); @@ -180,17 +184,17 @@ namespace clitk { else { std::string list = CreateListOfTypes(); - std::cerr << "Error, I don't know the vector output type '" << outputPixelType + std::cerr << "Error, I don't know the vector output type '" << outputPixelType << "'. " << std::endl << "Known types are " << list << "." << std::endl; return false; } - + return true; } - + private: - - template + + template static void UpdateWithOutputVectorType(ImageConvertGenericFilter& filter) { // Read @@ -201,7 +205,7 @@ namespace clitk { // Warning filter.CheckTypes(filter.GetInputPixelTypeName(), filter.GetOutputPixelTypeName()); - + // Cast typedef itk::Image, InputImageType::ImageDimension> OutputImageType; typedef itk::VectorCastImageFilter FilterType; @@ -220,4 +224,3 @@ namespace clitk { } // end namespace #endif /* end #define CLITKIMAGECONVERTGENERICFILTER_H */ -