///
void GimmickView::Initialize()
{
+ row="";
+ col="";
+ plane="";
+ selectionSize=0;
}
//======================================================================
i->second->UpdateLevel(l);
}
//======================================================================
+ /// Clears the status and begins a new selection process
+ void GimmickView::ClearStatus()
+ {
+ row="";
+ col="";
+ plane="";
+ selectionSize=0;
+ valid=true;
+ }
+ //======================================================================
///Validates the dimension compliance of the images with the maximum and
///minimum given, and between their sizes
- bool GimmickView::ValidateSelected (std::vector<tree::Node*>& sel, int min_dim, int max_dim)
+ bool GimmickView::ValidateSelected (tree::Node* sel, int min_dim, int max_dim)
{
GimmickMessage(2,"Validating selected"<<std::endl);
-
- bool valid=true;
-
- // EED validate all
+ selectionSize++;
+ /*// EED validate all
mValidationSignal(valid);
- return valid;
+ return valid;*/
int level;
std::string mMessage;
- if(sel.size()>0)
+
+ if(row.compare("")==0 || col.compare("")==0)
{
- std::vector<tree::Node*>::iterator i;
- std::string row;
- std::string col;
- std::string plane;
-
- //Validation between image sizes
- for (i=sel.begin(); i!=sel.end() && valid; ++i)
- {
- if(i==sel.begin())
- {
- row=(*i)->GetAttribute("D0028_0010");
- col=(*i)->GetAttribute("D0028_0011");
- plane=(*i)->GetAttribute("D0028_0012");
- level=(*i)->GetLevel();
-
- }
- else
+ row=(*sel).GetAttribute("D0028_0010");
+ col=(*sel).GetAttribute("D0028_0011");
+ plane=(*sel).GetAttribute("D0028_0012");
+ level=(*sel).GetLevel();
+ }
+ else
+ {
+ if(((*sel).GetAttribute("D0028_0010"))!=row ||
+ ((*sel).GetAttribute("D0028_0011"))!=col ||
+ ((*sel).GetAttribute("D0028_0012"))!=plane)
{
- if(((*i)->GetAttribute("D0028_0010"))!=row ||
- ((*i)->GetAttribute("D0028_0011"))!=col ||
- ((*i)->GetAttribute("D0028_0012"))!=plane)
- {
- mMessage="The selected images are not compatible.";
- valid=false;
- }
+ mMessage="The selected images are not compatible.";
+ valid=false;
}
- }
+ }
+
//Dimention validation
//Compatibility with maximum and minimum
valid= false;
}
- if ( dim < min_dim && sel.size()<2 )
+ if ( dim < min_dim )
{
- GimmickDebugMessage(2, "State Check: Dim: "
+ GimmickMessage(1, "State Check: Dim: "
<<dim
<<" Dim min:"
<<min_dim
<<std::endl);
mMessage="Cannot build the selection as it would result in a ";
- mMessage+=dim;
+ std::string a;
+ std::stringstream out;
+ out<<dim;
+ a=out.str();
+ mMessage+=a;
mMessage+="D image, and the minimum is ";
- mMessage+=min_dim;
+ out<<min_dim;
+ a=out.str();
+ mMessage+=a;
mMessage+="D!";
valid= false;
}
}
- }
- else
- {
- mMessage="Cannot have 0 images selected";
- valid=false;
- }
+
+
if(valid)
{
mMessage="Selection OK !";
{
if (filename.size()==0)
{
+ //What to do in this case?
+ /*
GimmickDebugMessage(5,
"Pushing unknown image in queue"
<<std::endl);
- mImageEventQueue.push_back(ImageEventType(image));
+ mImageEventQueue.push_back(ImageEventType(image));*/
return;
}
ImageEventTypeMap::iterator i;