- if(valid)
- {
- int rows;
- int cols;
- int planes;
- std::string s;
- std::istringstream t(s);
- s=row;
- t >> 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)
- {
- GimmickMessage(1,
- "Unknown image dimension : cannot select !"
- <<dim<<" "
- <<plane<<" "
- <<col<<" "
- <<row<<" "
- << std::endl);
- valid= false;
- }
- else if (dim>GetMaxDimension())
- {
- GimmickMessage(1,"Selecting "<<dim<<"D images is not allowed !"
- << std::endl);
- valid= false;
- }
- if ( dim == GetMaxDimension() )
- {
- GimmickMessage(1,"Cannot add this image to selection : would result in a "<<dim+1<<"D image !" << std::endl);
- valid= false;
+ if(valid)
+ {
+ int rows;
+ int cols;
+ int planes;
+ std::string s;
+ std::istringstream t(s);
+ s=row;
+ t >> 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)
+ {
+ GimmickMessage(1,
+ "Unknown image dimension : cannot select !"
+ <<dim<<" "
+ <<plane<<" "
+ <<col<<" "
+ <<row<<" "
+ << std::endl);
+ valid= false;
+ }
+ else if (dim>GetMaxDimension())
+ {
+ GimmickMessage(1,"Selecting "<<dim<<"D images is not allowed !"
+ << std::endl);
+ valid= false;
+ }
+ if ( dim == GetMaxDimension() )
+ {
+ GimmickMessage(1,"Cannot add this image to selection : would result in a "
+ <<dim+1<<"D image !" << std::endl);
+ valid= false;
+ }
+ if ( dim < GetMinDimension() && sel.size()<2 )
+ {
+ GimmickMessage(1,"Cannot build the selection as it would result in a "
+ <<dim<<"D image, and the minimum is"<<GetMinDimension()<<"D!" << std::endl);
+ valid= false;
+ }