X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=src%2FcreaImageIOWxAnySimpleDlg.cpp;fp=src%2FcreaImageIOWxAnySimpleDlg.cpp;h=11d5fa92d60a79d6b4e5436c66ada2cd8deaeaa6;hb=69b4e990347bac15882c7f45758b69cfebb5e62a;hp=58b7d95c0fd57e42fed654352c35bd22bde14f6f;hpb=abc0f1167f95cd0ed091cfbd3ac6df41445caf90;p=creaImageIO.git diff --git a/src/creaImageIOWxAnySimpleDlg.cpp b/src/creaImageIOWxAnySimpleDlg.cpp index 58b7d95..11d5fa9 100644 --- a/src/creaImageIOWxAnySimpleDlg.cpp +++ b/src/creaImageIOWxAnySimpleDlg.cpp @@ -108,27 +108,31 @@ namespace creaImageIO 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 i_exts) { m_exts = i_exts; } - ///////////////////////////////////////////////////////////////////// + +///////////////////////////////////////////////////////////////////// // // ////////////////////////////////////////////////////////////////////// - void WxAnySimpleDlg::OnReadDirectory(wxCommandEvent &event) { +printf("EED WxAnySimpleDlg::OnReadDirectory Start\n"); int resultShowModal; bool bvalid = false; long style = wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST; @@ -138,33 +142,58 @@ namespace creaImageIO if ( resultShowModal==wxID_OK ) { std::string path = crea::wx2std(dirDlg->GetPath()); +printf("EED WxAnySimpleDlg::OnReadDirectory path %s\n", path.c_str() ); + +/* 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::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::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 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() ); + cout << " " << *it << '\n'; + } + + + + + } // if OK SetReturnCode( resultShowModal ); // Close(); EndModal( resultShowModal ); +printf("EED WxAnySimpleDlg::OnReadDirectory End\n"); + } ////////////////////////////////////////////////////////////////////// @@ -236,9 +265,13 @@ namespace creaImageIO return imageIO->GetNumberOfDimensions(); } + void WxAnySimpleDlg::readImg(const std::string &i_name) { size_t dims = getNumberOfDimensions(i_name); + +printf("EED WxAnySimpleDlg::readImg dims=%d \n",dims); + //const std::type_info *type= &getType(i_name); switch(dims) { @@ -345,6 +378,7 @@ namespace creaImageIO } else { + printf("EED WxAnySimpleDlg::readImg Not type found for DIM 3 \n"); //????FCY, so what the type???? } break; @@ -487,6 +521,7 @@ namespace creaImageIO } else { + printf("EED WxAnySimpleDlg::readImg Not type found for DIM 4 \n"); //????FCY, so what the type???? } break;