*/
+#include <vtkVersionMacros.h>
#include "creaImageIOWxAnySimpleDlg.h"
#include "creaImageIOWxGimmickReaderDialog.h"
void WxAnySimpleDlg::OnReadFile(wxCommandEvent& event)
{
int resultShowModal;
+//EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
+#if wxMAJOR_VERSION <= 2
wxFileDialog* fileDlg = new wxFileDialog( 0, _T("Select file"), _T(""), _T(""), crea::std2wx("*"), wxOPEN |wxFD_MULTIPLE, wxDefaultPosition);
+#else
+ wxFileDialog* fileDlg = new wxFileDialog( 0, _T("Select file"), _T(""), _T(""), crea::std2wx("*"), wxFD_OPEN |wxFD_MULTIPLE, wxDefaultPosition);
+#endif
resultShowModal = fileDlg->ShowModal();
if ( resultShowModal==wxID_OK )
std::string name = crea::wx2std(wxArray[i]);
// FOR THE MOMENT ONLY short 3D et short 4D
readImg(name);
- }
- }
- else {
+ } // for
+ } else {
// TO DO WARNING MESSAGES
- }
- }
+ } // if
+ } // if
SetReturnCode( resultShowModal );
// Close();
EndModal( resultShowModal );
}
+
+/////////////////////////////////////////////////////////////////////
+// //
+//////////////////////////////////////////////////////////////////////
void WxAnySimpleDlg::setExts(std::vector<std::string> i_exts)
{
m_exts = i_exts;
}
- /////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////
// //
//////////////////////////////////////////////////////////////////////
-
void WxAnySimpleDlg::OnReadDirectory(wxCommandEvent &event)
{
int resultShowModal;
if ( resultShowModal==wxID_OK )
{
std::string path = crea::wx2std(dirDlg->GetPath());
+
+/*
typedef boost::filesystem::directory_iterator dir_it;
dir_it itr(path);
dir_it end_itr;
- /*if (boost::filesystem::exists(path))
- {*/
+// if (boost::filesystem::exists(path))
+// {
for(;itr != end_itr; ++itr)
{
- bvalid = m_exts.size() == 0? true : false;
- std::vector<std::string>::iterator it = m_exts.begin();
- std::string ext = itr->path().filename().string().substr(itr->path().filename().string().find_last_of("."));
- for(; it != m_exts.end(); it++)
- {
- if(ext == (*it) )
- {
- bvalid = true;
- break;
- }
- }
+//EED
+// All files have the same extention
+// bvalid = m_exts.size() == 0? true : false;
+// std::vector<std::string>::iterator it = m_exts.begin();
+// std::string ext = itr->path().filename().string().substr(itr->path().filename().string().find_last_of("."));
+// for(; it != m_exts.end(); it++)
+// {
+// if(ext == (*it) )
+// {
+// bvalid = true;
+// break;
+// }
+// } // for
+bvalid=true;
if (!boost::filesystem::is_directory(itr->status()) && bvalid)
{
- readImg(itr->path().string().c_str());
- }
- }
- }
+printf("EED WxAnySimpleDlg::OnReadDirectory Each file %s \n", itr->path().string().c_str() );
+ readImg( itr->path().string().c_str() );
+ } // if
+ } // for itr
+*/
+
+ typedef vector<boost::filesystem::path> vec; // store paths
+ vec v; // so we can sort them later
+ copy(boost::filesystem::directory_iterator(path), boost::filesystem::directory_iterator(), back_inserter(v));
+ sort(v.begin(), v.end()); // sort, since directory iteration
+ // is not ordered on some file systems
+ for (vec::const_iterator it (v.begin()); it != v.end(); ++it)
+ {
+ readImg( it->string().c_str() );
+ } // for
+
+
+
+
+ } // if OK
SetReturnCode( resultShowModal );
// Close();
EndModal( resultShowModal );
+
}
//////////////////////////////////////////////////////////////////////
return imageIO->GetNumberOfDimensions();
}
+
void WxAnySimpleDlg::readImg(const std::string &i_name)
{
size_t dims = getNumberOfDimensions(i_name);
+
//const std::type_info *type= &getType(i_name);
switch(dims)
{
}
else
{
+ printf("EED WxAnySimpleDlg::readImg Not type found for DIM 3 \n");
//????FCY, so what the type????
}
break;
}
else
{
+ printf("EED WxAnySimpleDlg::readImg Not type found for DIM 4 \n");
//????FCY, so what the type????
}
break;