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
}
}
+
+ 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<<"x"<<planes << std::endl;
- //Dimention validation
- //Compatibility with maximum and minimum
- 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)
- {
- 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: "
- <<dim
- <<" Dim min:"
- <<min_dim
- <<std::endl);
- mMessage="Cannot build the selection as it would result in a ";
- std::string a;
- std::stringstream out;
- out<<dim;
- a=out.str();
- mMessage+=a;
- mMessage+="D image, and the minimum is ";
- out<<min_dim;
- a=out.str();
- mMessage+=a;
- mMessage+="D!";
- valid= false;
- }
- }
+ 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: "
+ <<dim
+ <<" Dim min:"
+ <<min_dim
+ <<std::endl);
+ std::stringstream out;
+ out << "Cannot build the selection as it would result in a ";
+ out << dim;
+ out << "D image, and the minimum is ";
+ out << min_dim;
+ out << "D!";
+ mMessage+=out.str();
+ valid= false;
+ }
+ }
if(valid)
- {
- mMessage="Selection OK !";
- }
+ {
+ std::stringstream out;
+ out << dim << "D image " << cols << "x"<< rows << "x"<< planes <<" selected";
+ mMessage = out.str();
+ }
}
mValidationSignal(valid);
SetMessage(mMessage);
i->ShallowCopy(mUnreadableImage);
}
// std::cout << "i="<<i<<std::endl;
-std::cout<<"return: "<<i->GetScalarTypeAsString()<<", pointer="<<i<<std::endl;
+ //std::cout<<"return: "<<i->GetScalarTypeAsString()<<", pointer="<<i<<std::endl;
return i;
}
//=====================================================================
{
if (parent)
{
- GimmickMessage(5,"Default Node constructor (level "<<GetLevel()<<")"
+ GimmickDebugMessage(6,"Default Node constructor (level "<<GetLevel()<<")"
<< std::endl);
// Insert into parent's children list
parent->GetChildrenList().push_back(this);
}
else
{
- GimmickMessage(5,"Default Node constructor without parent"
+ GimmickDebugMessage(6,"Default Node constructor without parent"
<< std::endl);
}
}
mData(0),
mChildrenLoaded(false)
{
- GimmickMessage(5,"Node constructor (level "<<GetLevel()<<")"
+ GimmickDebugMessage(6,"Node constructor (level "<<GetLevel()<<")"
<< std::endl);
if (parent)
{
{
v = i->second;
}
- GimmickMessage(5,"Setting attribute '"<<a->GetName()<<"' = '"
+ GimmickDebugMessage(6,"Setting attribute '"<<a->GetName()<<"' = '"
<<v<<"'"<<std::endl);
UnsafeSetAttribute( a->GetKey(), v );
}
//=============================================================
Node::~Node()
{
- GimmickMessage(5,"Node destructor"
+ GimmickDebugMessage(6,"Node destructor"
<< std::endl);
ChildrenListType::iterator i;
for (i=GetChildrenList().begin(); i!=GetChildrenList().end(); i++)
//=============================================================
bool Node::Matches( const AttributeMapType& m ) const
{
- GimmickMessage(2,"'"<<GetLabel()<<"' matching..."<<std::endl);
+ GimmickDebugMessage(2,"'"<<GetLabel()<<"' matching..."<<std::endl);
const std::vector<std::string>& id
= GetLevelDescriptor().GetIdentifierList();
std::vector<std::string>::const_iterator i;
{
if (mAttributeMap.find(*i)->second != m.find(*i)->second )
{
- GimmickMessage(2,"IDENTIFIER '"<<*i<<"' values do not match"<<std::endl);
+ GimmickDebugMessage(2,"IDENTIFIER '"<<*i<<"' values do not match"<<std::endl);
return false;
}
- GimmickMessage(2,"IDENTIFIER '"<<*i<<"' values match"<<std::endl);
+ GimmickDebugMessage(2,"IDENTIFIER '"<<*i<<"' values match"<<std::endl);
}
return true;
}
std::vector<std::string>::const_iterator i;
for (i = label.begin(); i != label.end(); )
{
- GimmickMessage(3,"LABEL '"<<*i<<"'"<<std::endl);
+ GimmickDebugMessage(9,"LABEL '"<<*i<<"'"<<std::endl);
AttributeMapType::const_iterator j = mAttributeMap.find(*i);
if (j != mAttributeMap.end())
{
//Setting first column (number of children)
std::ostringstream oss;
- int n= GetTreeHandler()->GetNumberOfChildren(*j);
+ int n= 0; //GetTreeHandler()->GetNumberOfChildren(*j);
oss << n;
std::string s(oss.str());
item->SetText( crea::std2wx(s));
if (val.size()==0) val = "?";
item->SetText( crea::std2wx(val));
item->SetColumn(k);
- GetCtrl(l)->SetItem(*item);
- GetCtrl(l)->RefreshItem(*item);
+ GetCtrl(l)->SetItem(*item);
+ // Unefficient
+ // GetCtrl(l)->RefreshItem(*item);
}
}
else
item->SetText( crea::std2wx(val));
item->SetColumn(k);
GetCtrl(l)->SetItem(*item);
- GetCtrl(l)->RefreshItem(*item);
+ // GetCtrl(l)->RefreshItem(*item);
}
}
GetCtrl(l)->Show();
- if (level<mLevelList.size()) UpdateLevel(level+1);
+ // if (level<mLevelList.size()) UpdateLevel(level+1);
}
//=====================================================================
GetTreeHandler()->GetTree().GetLabel()
<<" view : item selected "
<<std::endl);
-
+
wxListItem info;
info.m_itemId = event.m_itemIndex;
- mLastSelected=event.m_itemIndex;
- // retrieve the level
- wxObject* obj = event.GetEventObject();
- unsigned int level = 0;
- for (level = 0; level<mLevelList.size(); ++level)
- {
+ mLastSelected = event.m_itemIndex;
+ // retrieve the level
+ wxObject* obj = event.GetEventObject();
+ unsigned int level = 0;
+ for (level = 0; level<mLevelList.size(); ++level)
+ {
if ( GetCtrl(level) == obj ) break;
- }
- GimmickDebugMessage(1,
+ }
+ GimmickDebugMessage(1,
" Level "<<level+1
<<std::endl);
- /*
- if(event.m_itemIndex!=0)
- {*/
- if(level<mLevelList.size()-1)
- {
- mSelected=GetSelected(level+2);
- }
- else if(mProcess)
- {
- mLastLevelSelected=GetSelected(level+2);
- }
- else
- {
- event.Veto();
- }
-
- if (level<mLevelList.size()-1)
- {
- UpdateLevel( level + 2 );
- GetGimmickView()->ClearSelection();
- }
- if (level==mLevelList.size()-2) SelectLowerLevel();
- if (level==(mLevelList.size()-1)&&mProcess)
- {
- if(event.GetEventType()==10145)
- {
- ValidateSelectedImages (true);
- }
- else
- {
- ValidateSelectedImages (false);
- }
- }
- //SetColor(level,event.m_itemIndex);
- /*}
+ /*
+ if(event.m_itemIndex!=0)
+ {*/
+
+ if(level<mLevelList.size()-1)
+ {
+ //mSelected=GetSelected(level+1); //2);
+ }
+ else if(mProcess)
+ {
+ //mLastLevelSelected=GetSelected(level+1); //2);
+ }
+ else
+ {
+ event.Veto();
+ }
+
+ // Update the children level (if selection not at last level)
+ if (level<mLevelList.size()-1)
+ {
+ UpdateLevel( level + 2 );
+ // Reset the viewer setting the default image
+ GetGimmickView()->ClearSelection();
+ }
+ // Select all images if the selection is at series level
+ if (level==mLevelList.size()-2) SelectLowerLevel();
+ // Validate selected images if the selection is at image level
+ if (level==(mLevelList.size()-1)&&mProcess)
+ {
+ if(event.GetEventType()==10145)
+ {
+ ValidateSelectedImages (true);
+ }
else
- {
- if(event.GetEventType()==10145)
- {
-
- GetCtrl(level)->SetItemText(0,crea::std2wx(""));
- GetCtrl(level)->EditLabel(event.m_itemIndex);
- }
-
- }*/
-
-
+ {
+ ValidateSelectedImages (false);
+ }
+ }
+ //SetColor(level,event.m_itemIndex);
+ /*}
+ else
+ {
+ if(event.GetEventType()==10145)
+ {
+
+ GetCtrl(level)->SetItemText(0,crea::std2wx(""));
+ GetCtrl(level)->EditLabel(event.m_itemIndex);
+ }
+
+ }*/
+
+
}
//================================================================
size)
{
wxMutexLocker lock(mMutex);
- GimmickDebugMessage(1,"WxViewer::WxViewer"
+ GimmickDebugMessage(6,"WxViewer::WxViewer"
<<std::endl);
mNeedRefresh = false;
WxViewer::~WxViewer()
{
wxMutexLocker lock(mMutex);
- GimmickDebugMessage(1,"WxViewer::~WxViewer"
+ GimmickDebugMessage(6,"WxViewer::~WxViewer"
<<std::endl);
// TO DO : desallocate cleanly
// delete mPlayer;
void WxViewer::SetImageVector(std::vector<ImagePointerHolder*>& pointers)
{
wxMutexLocker lock(mMutex);
- GimmickMessage(1,"WxViewer::SetImageVector"<<std::endl);
+ GimmickDebugMessage(6,"WxViewer::SetImageVector"<<std::endl);
imagePointers=pointers;
}
wxMutexLocker lock(mMutex);
- GimmickMessage(10,"WxViewer::ShowNextImage() "
+ GimmickDebugMessage(10,"WxViewer::ShowNextImage() "
<<mCurrent+1<<"/"
<<imagePointers.size()<<std::endl);
void WxViewer::ShowImage(vtkImageData* im)
{
- GimmickDebugMessage(5,"WxViewer::ShowImage"
+ GimmickDebugMessage(6,"WxViewer::ShowImage"
<<std::endl);
if (im==0) return;
{
if (mNeedRefresh)
{
- GimmickMessage(1,"WxViewer : Refreshing"<<std::endl);
+ GimmickDebugMessage(10,"WxViewer : Refreshing"<<std::endl);
mInteractor->Render();
mNeedRefresh = false;
void* WxViewerPlayer::Entry()
{
- GimmickMessage(1,"WxViewerPlayer::Entry()"<<std::endl);
+ GimmickDebugMessage(6,"WxViewerPlayer::Entry()"<<std::endl);
while(!TestDestroy())
{
//=====================================================================
void WxViewerPlayer::OnExit()
{
- GimmickMessage(1,"WxViewerPlayer::OnExit() "<<std::endl);
+ GimmickDebugMessage(6,"WxViewerPlayer::OnExit() "<<std::endl);
}