X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=src2%2FcreaImageIOGimmickView.cpp;h=9d2b3dcb199d5a61c17dcb10a0bfdcf1b4bde850;hb=cac026929f2431aa4a966bf9ae3c8ff263f5dd63;hp=5da98b5c47d289f80b9300db674fe7c05dfe46e8;hpb=eb57b703668a22b19df49f57aeb0bca95f048029;p=creaImageIO.git diff --git a/src2/creaImageIOGimmickView.cpp b/src2/creaImageIOGimmickView.cpp index 5da98b5..9d2b3dc 100644 --- a/src2/creaImageIOGimmickView.cpp +++ b/src2/creaImageIOGimmickView.cpp @@ -92,6 +92,29 @@ namespace creaImageIO selectionSize=0; valid=true; } + + + class ImageExtent + { + public: + ImageExtent(const std::string& x, const std::string& y, const std::string& z, const std::string& t); + + void Clear() { mExtent[0] = mExtent[1] = mExtent[2] = mExtent[3] = 1; } + + bool IsCompatible( const ImageExtent& ); + + void Add ( const ImageExtent& ); + + int Get(int i) { return mExtent[i]; } + + int GetDimension() { return mDim; } + + private: + int mExtent[4]; + int mDim; + }; + + //====================================================================== ///Validates the dimension compliance of the images with the maximum and ///minimum given, and between their sizes @@ -132,79 +155,74 @@ namespace creaImageIO } } + + int dim = 0; + int rows; + int cols; + int planes; + + //Dimention validation + //Compatibility with maximum and minimum + if(valid) + { + sscanf(row.c_str(),"%d",&rows); + sscanf(col.c_str(),"%d",&cols); + sscanf(plane.c_str(),"%d",&planes); + if(row==""){rows=1;} + if(col==""){cols=1;} + if(plane==""){planes=1;} + + std::cout << cols << "x"<> rows; - if(row==""){rows=1;} - s=col; - t >> cols; - if(col==""){cols=1;} - s=plane; - t >> planes; - if(plane==""){planes=1;} - - int dim = 0; - if (planes>1) dim=3; - else if (cols>1) dim=2; - else if (rows>1) dim=1; - - if (dim == 0) - { - mMessage="Unknown image dimension : cannot select !"; - valid= false; - } - else if (dim>max_dim) - { - mMessage="Selecting "; - mMessage+=dim; - mMessage+="D images is not allowed !"; - valid= false; - } - if ( dim == max_dim ) - { - mMessage="Cannot add this image to selection : would result in a "; - mMessage+=(dim+1); - mMessage+="D image!"; - - valid= false; - } - if ( dim < min_dim ) - { - GimmickMessage(1, "State Check: Dim: " - <1) dim=3; + else if (cols>1) dim=2; + else if (rows>1) dim=1; + + if (dim == 0) + { + mMessage="Unknown image dimension : cannot select !"; + valid= false; + } + else if (dim>max_dim) + { + mMessage="Selecting "; + mMessage+=dim; + mMessage+="D images is not allowed !"; + valid= false; + } + if ( dim == max_dim ) + { + mMessage="Cannot add this image to selection : would result in a "; + mMessage+=(dim+1); + mMessage+="D image!"; + + valid= false; + } + if ( dim < min_dim ) + { + GimmickMessage(1, "State Check: Dim: " + <