X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;ds=inline;f=src2%2FcreaImageIOWxGimmickView.cpp;h=d961fcaed852ca5047dda541f7ac29a40fc66735;hb=da80530068246081505e9649523d10e8da8e6acd;hp=63e393af5a903cf56e9957139222386dbab610c7;hpb=93692028fda538964e7ce2216e08b04d600b7a5e;p=creaImageIO.git diff --git a/src2/creaImageIOWxGimmickView.cpp b/src2/creaImageIOWxGimmickView.cpp index 63e393a..d961fca 100644 --- a/src2/creaImageIOWxGimmickView.cpp +++ b/src2/creaImageIOWxGimmickView.cpp @@ -1,3 +1,5 @@ +#include +#include #include #include #include @@ -5,7 +7,6 @@ #include #include #include -#include #include using namespace crea; @@ -30,6 +31,10 @@ using namespace crea; #include "bruker2dicom.h" #endif +#ifdef _DEBUG +#define new DEBUG_NEW +#endif + namespace creaImageIO { @@ -46,6 +51,7 @@ namespace creaImageIO TOOL_SETTINGS_ID = 7, TOOL_TOOLS_ID = 8, TOOL_CREATEDB_ID = 9, + TOOL_PACS_ID = 10 }; //====================================================================== @@ -83,7 +89,7 @@ namespace creaImageIO //====================================================================== // CTor - WxGimmickView::WxGimmickView(Gimmick* gimmick, + WxGimmickView::WxGimmickView(boost::shared_ptr gimmick, wxWindow *parent, const wxWindowID id, const wxPoint& pos, @@ -113,23 +119,21 @@ namespace creaImageIO // Create the tool bar CreateToolBar(); - sizer->Add( mToolBar ,0, wxGROW ,0); + sizer->Add( mToolBar, 0, wxGROW, 0); // Split part below toolbar into notebook for views and panel // for preview, messages... mSplitter = new wxSplitterWindow( this , -1); - - + // Notebook mNotebook = new wxNotebook(mSplitter, - -1,wxDefaultPosition, wxDefaultSize, 0); + -1, wxDefaultPosition, wxDefaultSize, 0); //Gimmick mGimmick=gimmick; - - mSelectionMaxDimension= max_dim; - mSelectionMinDimension= min_dim; + mSelectionMaxDimension = max_dim; + mSelectionMinDimension = min_dim; // Create the views CreateTreeViews(); @@ -142,9 +146,11 @@ namespace creaImageIO // Previewer mViewer = new WxViewer(mBottomPanel, wxID_ANY, wxT("Gimmick! Viewer"),wxDefaultPosition, wxDefaultSize ); - pointers.push_back(new ImagePointerHolder(GetDefaultImage())); - mViewer->SetImageVector(pointers); - mViewer->StartPlayer(); + //pointers.push_back(new ImagePointerHolder(GetDefaultImage()) + pointers.push_back(boost::shared_ptr(new ImagePointerHolder(GetDefaultImage()))); + + mViewer->SetImageVector(pointers); + mViewer->StartPlayer(); bottom_sizer->Add(mViewer,1,wxGROW,1); @@ -167,14 +173,14 @@ namespace creaImageIO mSplitter->SplitHorizontally( mNotebook, mBottomPanel, top_minsize); - sizer->Add( mSplitter,1,wxGROW ,0); + sizer->Add( mSplitter, 1, wxGROW, 0); mProgressDialog=0; SetSizer( sizer ); SetAutoLayout(true); Layout(); mListener=new Listener(); - mListener->ConnectObserver(boost::bind( &WxGimmickView::OnDriveMount , this, _1 ) ); + mListener->ConnectObserver(boost::bind( &WxGimmickView::OnDriveMount, this, _1 ) ); mListener->Create(); mListener->Run(); mListener->Pause(); @@ -191,6 +197,7 @@ namespace creaImageIO mViewer->StopPlayer(); GimmickDebugMessage(1,"WxGimmickView::~WxGimmickView" <IsAlive()) { mListener->Delete(); @@ -251,7 +258,13 @@ namespace creaImageIO mIcon->GetBitmap(Icon_create_database), _T("Create DB from an Attributes Descriptor file") ); - +#if defined(BUILD_PACS) + mToolAddFile = mToolBar->AddTool( TOOL_PACS_ID, + _T("PACS Connection,"), + mIcon->GetBitmap(Icon_create_database), + _T("Echo, Find and Get to a PACS") + ); +#endif //const wxBitmap& bitmap1, const wxString& shortHelpString = "", wxItemKind kind = wxITEM_NORMAL) mToolBar->Realize(); @@ -267,7 +280,7 @@ namespace creaImageIO GimmickMessage(2,"Creating the tree view for '"<< name<<"'"< files; GetTreeViewMap()[crea::wx2std(mNotebook->GetPageText(mNotebook->GetSelection()))]->GetSelectedAsString(files); - ReadImagesNotThreaded(s,files,dim); + ReadImagesNotThreaded(s, files, dim); + } + + //====================================================================== + void WxGimmickView::GetSelectedImagesInVector(std::vector& s, int dim) + { + std::vector files; + GetTreeViewMap()[crea::wx2std(mNotebook->GetPageText(mNotebook->GetSelection()))]->GetSelectedAsString(files); + ReadImagesNotThreadedInVector(s, files, dim); } //====================================================================== @@ -312,17 +333,17 @@ namespace creaImageIO wxIcon icons[20]; // should correspond to Icon_xxx enum - icons[Icon_accept] = wxIcon(accept_xpm); - icons[Icon_add] = wxIcon(add_xpm); - icons[Icon_folder_down] = wxIcon(folder_down_xpm); - icons[Icon_page_down] = wxIcon(page_down_xpm); - icons[Icon_remove] = wxIcon(remove_xpm); - icons[Icon_database_add] = wxIcon(database_add_xpm); - icons[Icon_help] = wxIcon(help_xpm); - icons[Icon_synchronize] = wxIcon(synchronize_xpm); + icons[Icon_accept] = wxIcon(accept_xpm); + icons[Icon_add] = wxIcon(add_xpm); + icons[Icon_folder_down] = wxIcon(folder_down_xpm); + icons[Icon_page_down] = wxIcon(page_down_xpm); + icons[Icon_remove] = wxIcon(remove_xpm); + icons[Icon_database_add] = wxIcon(database_add_xpm); + icons[Icon_help] = wxIcon(help_xpm); + icons[Icon_synchronize] = wxIcon(synchronize_xpm); icons[Icon_create_database] = wxIcon(create_database_xpm); - icons[Icon_settings] = wxIcon(settings_xpm); - icons[Icon_tools] = wxIcon(tools_xpm); + icons[Icon_settings] = wxIcon(settings_xpm); + icons[Icon_tools] = wxIcon(tools_xpm); // unsigned int NbIcons = 8; // Make an image list containing small icons @@ -379,8 +400,8 @@ namespace creaImageIO 1000, this, wxPD_ELAPSED_TIME | - // wxPD_ESTIMATED_TIME | - // wxPD_REMAINING_TIME | + // wxPD_ESTIMATED_TIME | + // wxPD_REMAINING_TIME | wxPD_CAN_ABORT ); // TO DO : select the current tree handler @@ -411,15 +432,13 @@ namespace creaImageIO if (FD->ShowModal()==wxID_OK) { - - std::string dirname = wx2std (FD->GetPath()); bool recurse = isNeedRecursive(dirname); if (recurse) { - recurse = wxMessageBox(_T("Recurse into sub-directories ?"), _T("Scan directory"), wxYES_NO,this ) == wxYES ? true : false; + recurse = wxMessageBox(_T("Recurse into sub-directories ?"), _T("Scan directory"), wxYES_NO,this ) == wxYES ? true : false; } - + wxBusyCursor busy; wxString title(_T("Adding directory")); if (recurse) @@ -431,24 +450,23 @@ namespace creaImageIO this, wxPD_ELAPSED_TIME | wxPD_SMOOTH | - // wxPD_ESTIMATED_TIME | - // wxPD_REMAINING_TIME | + // wxPD_ESTIMATED_TIME | + // wxPD_REMAINING_TIME | wxPD_CAN_ABORT ); - + mCurrentDirectory = FD->GetPath(); mGimmick->AddDir(crea::wx2std(mNotebook->GetPageText(mNotebook->GetSelection())),dirname,recurse); mProgressDialog->Pulse(_T("Updating view...")); - + UpdateTreeViewLevel(crea::wx2std(mNotebook->GetPageText(mNotebook->GetSelection())),1); delete mProgressDialog; DisplayAddSummary(); - } mViewer->StartPlayer(); } - //================================================= + //================================================= // Determines number of files potentially to add to database int WxGimmickView::NumberFilesToAdd(const std::string &dirpath, bool recursive) { @@ -471,10 +489,9 @@ namespace creaImageIO } } return nb; - } - //================================================= + //================================================= // Test a directory to know if contains sub-directory to analyze bool WxGimmickView::isNeedRecursive(std::string i_name) { @@ -544,8 +561,6 @@ namespace creaImageIO ClearSelection(); }*/ ReadImageThreaded(sel); - - } //================================================== @@ -573,7 +588,8 @@ namespace creaImageIO "Requesting image from selected " <<(*selected)->GetAttribute("FullFileName") < ph(new ImagePointerHolder(GetDefaultImage())); pointers.push_back(ph); RequestReading(*selected,prio,index,ph); // AddEntryToMap(*selected); @@ -592,7 +608,8 @@ namespace creaImageIO "Requesting image from neighbors up " <<(*iterUp)->GetAttribute("FullFileName") < ph(new ImagePointerHolder(GetDefaultImage())); RequestReading(*iterUp,prio,-1,ph); // AddEntryToMap(*iterUp); prio--; @@ -610,7 +627,8 @@ namespace creaImageIO "Requesting image from neighbors down " <<(*iterDown)->GetAttribute("FullFileName") < ph(new ImagePointerHolder(GetDefaultImage())); RequestReading(*iterDown,prio,-1,ph); // AddEntryToMap(*iterDown); prio--; @@ -620,7 +638,8 @@ namespace creaImageIO else { pointers.clear(); - ImagePointerHolder* ph=new ImagePointerHolder(GetDefaultImage()); + //ImagePointerHolder* ph=new ImagePointerHolder(GetDefaultImage()); + boost::shared_ptr ph(new ImagePointerHolder(GetDefaultImage())); pointers.push_back(ph); mViewer->SetImageVector(pointers); } @@ -653,12 +672,13 @@ namespace creaImageIO void WxGimmickView::ClearSelection() { pointers.clear(); - pointers.push_back(new ImagePointerHolder(GetDefaultImage())); + pointers.push_back(boost::shared_ptr(new ImagePointerHolder(GetDefaultImage()))); + //pointers.push_back(new ImagePointerHolder(GetDefaultImage())); mViewer->SetImageVector(pointers); mViewer->RefreshIfNecessary(); ResetExtent(); } - + //================================================= //================================================= @@ -671,12 +691,12 @@ namespace creaImageIO } //================================================= - + //================================================= void WxGimmickView::AddIgnoreFile(tree::Node* toRemove) { mGimmick->RemoveFile(crea::wx2std(mNotebook->GetPageText(mNotebook->GetSelection())),toRemove); - GetTreeViewMap()[crea::wx2std(mNotebook->GetPageText(mNotebook->GetSelection()))]->UpdateLevel(1); + // GetTreeViewMap()[crea::wx2std(mNotebook->GetPageText(mNotebook->GetSelection()))]->UpdateLevel(1); } //================================================= @@ -746,6 +766,7 @@ namespace creaImageIO dial->SetSizer(siz); dial->ShowModal(); } + //================================================= void WxGimmickView::OnImportExport(wxCommandEvent &Event) { @@ -812,7 +833,7 @@ namespace creaImageIO std::string inputDir = crea::wx2std(gimmickTools->getInputDir()); std::string outputDir = crea::wx2std(gimmickTools->getOutputDir()); - bool addToDB = gimmickTools->getCheckBoxValue(); + bool addToDB = gimmickTools->getAddToDBCheckBoxValue(); if (inputDir.compare("")!=0 && outputDir.compare("")!=0) { @@ -839,7 +860,6 @@ namespace creaImageIO } } } - else { wxMessageBox(_T("One or both of the directory fields are empty"),_T("Empty Fields"),wxOK,this); @@ -848,9 +868,9 @@ namespace creaImageIO delete gimmickTools; #endif } - mViewer->StartPlayer(); } + //================================================= void WxGimmickView::CreateSettingsDialog(wxNotebook* nb, wxDialog* dial) @@ -1077,6 +1097,7 @@ namespace creaImageIO ////////////////////////////////////////////////// void WxGimmickView::OnCreateDB(wxCommandEvent& event) { + // PACSConnection(""); WxDescriptorPanel * DescriptorPan = new WxDescriptorPanel(this, mGimmick->GetHomeDirectory()); DescriptorPan->Layout(); if ( DescriptorPan->ShowModal() == ID_DSCP_APPLY) @@ -1119,4 +1140,3 @@ namespace creaImageIO } // EO namespace creaImageIO -