]> Creatis software - creaImageIO.git/commitdiff
additional document for output
authorFrederic Cervenansky <Frederic.Cervenansky@creatis.insa-lyon.fr>
Wed, 12 May 2010 14:01:19 +0000 (14:01 +0000)
committerFrederic Cervenansky <Frederic.Cervenansky@creatis.insa-lyon.fr>
Wed, 12 May 2010 14:01:19 +0000 (14:01 +0000)
src/creaImageIOOutputModel.cpp [new file with mode: 0644]
src/creaImageIOOutputModel.h [new file with mode: 0644]
src/creaImageIOWxDumpPanel.cpp
src/creaImageIOWxOutputDlg.cpp [new file with mode: 0644]
src/creaImageIOWxOutputDlg.h [new file with mode: 0644]

diff --git a/src/creaImageIOOutputModel.cpp b/src/creaImageIOOutputModel.cpp
new file mode 100644 (file)
index 0000000..e072ea2
--- /dev/null
@@ -0,0 +1,402 @@
+#include <creaImageIOOutputModel.h>
+
+#include <boost/filesystem.hpp>
+#include "boost/algorithm/string.hpp"
+
+#if defined(USE_GDCM)
+#include <gdcmGlobal.h>
+#include <gdcmSerieHelper.h>
+#endif
+
+#if defined(USE_GDCM2)
+#include <gdcmDict.h>
+#include <gdcmDicts.h>
+#include <gdcmGlobal.h>
+#endif
+
+
+#if defined(USE_XERCES)
+#include <xercesc/dom/DOM.hpp>
+#include <xercesc/dom/DOMDocument.hpp>
+#include <xercesc/util/XMLString.hpp>
+#include <xercesc/util/PlatformUtils.hpp>
+using namespace xercesc;
+#endif
+
+
+namespace creaImageIO
+{
+
+
+       OutputModel::~OutputModel()
+       {
+       }
+
+                #if defined(USE_GDCM)
+        double OutputModel::orderFilesWithZspacing(std::vector<std::string> &im)
+       {
+               double spacing=1;
+               typedef std::vector<GDCM_NAME_SPACE::File* > FileList;
+               FileList fileVector;
+               //GDCM_NAME_SPACE::File *f = GDCM_NAME_SPACE::File::New();
+               GDCM_NAME_SPACE::SerieHelper *sh = GDCM_NAME_SPACE::SerieHelper::New();
+               std::vector<std::string> lstAux;
+               std::vector<std::string>::iterator it;
+               for (it=im.begin(); it!=im.end(); ++it)
+               {
+                       ///\TODO liberer les GDCM_NAME_SPACE::File a la fin!  // JPR
+                       GDCM_NAME_SPACE::File *f = GDCM_NAME_SPACE::File::New();
+                       f->SetFileName(*it);
+                       f->Load();
+                       if (f->IsReadable())
+                       {
+                               fileVector.push_back(f);
+                       } else {
+                               lstAux.push_back(*it);
+                       }
+               } // for
+                       
+               
+               if ((fileVector.size()>1) && (sh->IsCoherent( &fileVector )))
+               {
+                               sh->OrderFileList(&fileVector);
+                               spacing= sh->GetZSpacing();
+                               im.clear();
+                               int i;
+                               for (i=0; i<fileVector.size(); i++)
+                               {
+                                       im.push_back( (fileVector[i])->GetFileName() );
+                               }
+                               for (i=0; i<lstAux.size(); i++)
+                               {
+                                       im.push_back( lstAux[i] );
+                               }
+               }else {
+                       std::sort( im.begin(), im.end() );
+               }
+                               
+          return spacing;
+       }
+
+       #endif
+
+#if defined(USE_GDCM2)
+       // TO DO
+       double OutputModel::orderFilesWithZspacing(std::vector<std::string> &im)
+       {
+               return 1;
+       }
+#endif
+
+
+
+#if defined(USE_XERCES)
+
+       OutputModel::OutputModel(OutputModelParser *i_outparser) : m_outparser(i_outparser)
+       {
+               // Init
+               b_db = false;
+       }
+
+       //OutputModel::setOutputModel(std::vector< std::map<std::string, std::string>> i_outputs)
+       //{
+       //      std::vector< std::map<std::string, std::string>>::iterator it = i_outputs.begin();
+       //      for(; it != i_outputs.end(); it++)
+       //      {
+       //              checkModel((*it));
+       //      }
+       //}
+
+        bool OutputModel::checkModel(std::map<std::string, std::string> i_model, const std::string i_val)
+       {
+               bool bres = false;
+               if( i_model.find(i_val) != i_model.end() )
+               {
+                       bres = true;
+               }
+
+               return bres;
+
+       }
+
+       OutputModel::~OutputModel()
+       {
+       }
+       void OutputModel::setDB(const std::string i_db, const std::string i_table)
+       {
+               b_db = true;
+               m_db = i_db;
+               m_table = i_table;
+       }
+
+       const std::string OutputModel::getTag()
+       {
+               char key[12];
+               if (!m_tag.empty())
+               {
+                       return m_tag;
+               }
+               else
+               {
+#if defined(USE_GDCM)
+               sprintf(key,"D%04x_%04x", m_tag1.GetGroup(), m_tag1.GetElement());
+#endif
+#if defined(USE_GDCM2)
+               sprintf(key,"D%04x_%04x", m_tag2.GetGroup(), m_tag2.GetElement());
+#endif
+               return key;
+               }
+       }
+/*      void OutputModel::sort(const std::vector<std::string> i_filenames, std::vector<std::string> &o_sort)
+       {
+               std::vector<int> values;
+               if(bDicom)
+               {
+                       if(b_db)
+                       {
+                               getDBValues<int>(i_filenames, values);
+                       }
+                       else
+                       {
+                               getValues<int>(i_filenames, values);
+                       }
+               }
+               else
+               {
+                       for(int i = 0; i <i_filenames.size(); i++)
+                               values.push_back(i);
+               }
+
+               for(int index = tag_begin; index <= tag_end; index += tag_step)
+               {
+                       std::vector<int>::iterator it_val = values.begin();
+                       std::vector<std::string>::const_iterator it = i_filenames.begin();
+                       for(;it != i_filenames.end(); it_val++, it++)
+                       {
+                               if((*it_val) == index)
+                               {
+                                       o_sort.push_back((*it));
+                                       break;
+                               }
+                       }
+               }
+               if(m_model != NULL)
+                       m_model->sort(i_filenames, o_sort);
+       }*/
+       template<typename T>
+       void OutputModel::getDBValues(const std::vector<std::string> i_filenames, const std::string i_stag, std::map<std::string , T> &o_val)
+       {
+       }
+
+
+        //template<typename T>
+        //T OutputModel::getTypeTag()
+        //{
+               // GDCM_NAME_SPACE::DictEntry* entry =  GDCM_NAME_SPACE::Global::GetDicts()->GetDefaultPubDict()->GetEntry(GetGroup(),GetElement());
+               // entry->GetVR().GetVRType( entry->GetVR());
+               // 
+        //}
+
+       template<typename T>
+       void OutputModel::getValues(const std::vector<std::string> i_filenames,const std::string i_tag, std::map< std::string, T> &o_val)
+        {
+#if defined(USE_GDCM)
+                 getReadValues(i_filenames, o_val);
+#endif
+#if defined(USE_GDCM2)
+                 getScanValues(i_filenames, i_tag,o_val);
+#endif
+        }
+
+#if defined(USE_GDCM2)
+       // TO DO if some file don't provide this value, we are lost so return a map!
+       template<typename T>
+       void OutputModel::getScanValues(const std::vector<std :: string> i_filenames, const std::string i_stag, std::map<std::string,T> &o_val)
+       {
+               uint16_t gr, el;
+               sscanf(i_stag.c_str(),"D%04hx_%04hx ",&gr,&el); 
+               gdcm::Tag tag(gr, el);
+               if (!tag.IsIllegal())
+               {
+                       std::vector<std :: string> names(i_filenames);
+                       gdcm::Scanner scan;
+                       scan.ClearTags();
+                       scan.AddTag(tag);
+                       
+                       std::vector<std :: string>::iterator it = names.begin();
+                       for(;it != names.end(); it++)
+                               boost::algorithm::replace_all((*it),"\\", "/");
+                       scan.Scan(i_filenames);
+//                     const gdcm::Scanner::TagToValue &mapping = 
+                       std::vector<std::string>::const_iterator it_file = i_filenames.begin();
+                       for(; it_file != i_filenames.end(); it++)
+                       {
+                               if(     scan.GetMapping((*it_file).c_str()).begin() != scan.GetMapping((*it_file).c_str()).end())
+                               {
+                                       o_val[(*it)] = scan.GetMapping((*it_file).c_str()).begin()->second;
+                               }
+                               else
+                               {
+                                       o_val[(*it)] = "";
+                               }
+                       }
+               }
+                
+       }
+
+       //const gdcm::VR::VRType OutputModel::getType(const std::string i_tag)
+       //{
+       //      uint16_t gr, el;
+       //      sscanf(itag.c_str(),"D%04hx_%04hx ",&gr,&el); 
+       //      const gdcm::Global& g = gdcm::Global::GetInstance(); // sum of all knowledge !
+       //      const gdcm::Dicts &dicts = g.GetDicts();
+       //      const gdcm::Dict &dict = dicts.GetPublicDict(); // Part 6
+       //    gdcm::DictEntry dictentry =  dict.GetDictEntry(gdcm::Tag(gr, el));
+       //   return dictentry.GetVR();
+       //}
+#endif
+
+
+
+#if defined(USE_GDCM)
+       double OutputModel::orderFiles(std::vector<std::string> im, std::vector<std::string> &out)
+{
+       double spacing = 1;
+       std::vector<boost::shared_ptr<GDCM_NAME_SPACE::File> > fileVector;
+       std::vector<std::string> lstAux;
+       GDCM_NAME_SPACE::SerieHelper *sh = GDCM_NAME_SPACE::SerieHelper::New();
+       std::vector<std::string>::iterator it = im.begin();
+       for (; it!=im.end(); ++it)
+       {
+               GDCM_NAME_SPACE::File *f = GDCM_NAME_SPACE::File::New();
+               f->SetFileName(*it);
+               f->Load();
+               if (f->IsReadable())
+               {
+                       fileVector.push_back(f);
+               } 
+               else
+               {
+                       lstAux.push_back((*it));
+               }
+       } 
+       if ((fileVector.size()>1) && (sh->IsCoherent( &fileVector )))
+       {
+                       sh->OrderFileList(&fileVector);
+                       spacing= sh->GetZSpacing();
+                       out.clear();
+                       int i;
+                       for (i=0; i<fileVector.size(); i++)
+                       {
+                               out.push_back( (fileVector[i])->GetFileName() );
+                       }
+                       for (i=0; i<lstAux.size(); i++)
+                       {
+                               out.push_back( lstAux[i] );
+                       }
+       }
+       else
+       {
+               std::sort( im.begin(), im.end() );
+       }
+     return spacing;
+       }
+#endif 
+
+
+        void OutputModel::sort(const std::vector<std::string> i_filenames, std::vector<std::string> &o_sort, int level)
+       {
+#if defined(USE_XERCES)
+               int tags[3];
+                       tags[0] = 0;
+
+               int tag_end = i_filenames.size();
+               int tag_step = 1;
+               std::map<std::string, std::string> model = m_outparser->getLevel(level);
+               std::map<std::string, std::string> values;
+               
+               if( checkModel(model, OUTPUTMODEL_TAG(3)) && !b_db)
+               {
+#if defined (USE_GDCM2)
+                       
+                       //OutputSort< getType(model[OUTPUTMODEL_TAG(3)] > osort;
+                       
+                       getValues<std::string>(i_filenames, model[OUTPUTMODEL_TAG(3)], values);
+#endif
+               }
+               else
+               {
+                       OutputSort<std::string> osort;
+                       for(int i = 0; i < 3; i++)
+                       {
+                               if ( checkModel(model, OUTPUTMODEL_TAG(i)))
+                               {       
+                                       osort.setTag(model[OUTPUTMODEL_TAG(i)],OUTPUTMODEL_TAG(i));
+                               }
+                       }
+
+                       if(b_db)
+                       {
+                               getDBValues<std::string>(i_filenames,model[OUTPUTMODEL_TAG(3)], values);
+                       }
+                       else
+                       {
+                               for(int i = 0; i <i_filenames.size(); i++)
+                                       values[i_filenames[i]] = i;
+                               osort.sort(values,o_sort);
+                       }
+               }
+
+
+
+
+               for(int i = 1; i < 4; i++)
+               {
+                       if ( checkModel(model, OUTPUTMODEL_TAG(i)))
+                       {       
+                               sscanf(model[OUTPUTMODEL_TAG(i)].c_str(), "%d", tags[i]);
+                       }
+               }
+               
+               if( checkModel(model, OUTPUTMODEL_TAG(3)) )
+               {
+                       if(b_db)
+                       {
+                               getDBValues<std::string>(i_filenames,model[OUTPUTMODEL_TAG(3)], values);
+                       }
+                       else
+                       {
+                               getValues<std::string>(i_filenames, model[OUTPUTMODEL_TAG(3)], values);
+                       }
+               }
+               else
+               {
+                       for(int i = 0; i <i_filenames.size(); i++)
+                               values[i_filenames[i]] = i;
+               }
+
+               for(int index = tag_begin; index <= tag_end; index += tag_step)
+               {
+                       std::map<std::string, std::string>::iterator it_val = values.begin();
+                       for(;it_val != values.end(); it_val++)
+                       {
+                               if(it_val->second.c_str() )// == index)
+                               {
+                                       o_sort.push_back(it_val->first.c_str());
+                                       break;
+                               }
+                       }
+               }
+               if(checkModel(model, OUTPUTMODEL_TAG(4)))
+               {
+                       int lv;
+                       sscanf(model[OUTPUTMODEL_TAG(4)].c_str(), "%d", lv);
+                       sort(i_filenames,o_sort,lv);
+               }
+#endif
+       }
+
+#endif
+
+
+}
\ No newline at end of file
diff --git a/src/creaImageIOOutputModel.h b/src/creaImageIOOutputModel.h
new file mode 100644 (file)
index 0000000..ada72a3
--- /dev/null
@@ -0,0 +1,138 @@
+#ifndef __creaImageIOoutputModel_h_INCLUDED__
+#define __creaImageIOoutputModel_h_INCLUDED__
+#if defined (USE_XERCES)
+#include <creaImageIOOutputModelParser.h>
+#endif
+#if defined(USE_GDCM2)
+#include <gdcmScanner.h>
+#endif
+
+
+#define OUTPUTMODEL_TAG_i      ""
+#define OUTPUTMODEL_TAG_0      "TAG_BEGIN"
+#define OUTPUTMODEL_TAG_1      "TAG_END"
+#define OUTPUTMODEL_TAG_2      "TAG_STEP"
+#define OUTPUTMODEL_TAG_3      "DICOM_TAG"
+#define OUTPUTMODEL_TAG_4      "ANCHOR"
+#define OUTPUTMODEL_TAG(i)     OUTPUTMODEL_TAG_ ## i
+
+
+
+
+namespace creaImageIO
+{
+       class  OutputModel 
+       {
+       public:
+               OutputModel(){}
+               virtual ~OutputModel();
+               double orderFilesWithZspacing(std::vector<std::string> &im);
+
+#if defined(USE_XERCES)
+               OutputModel(OutputModelParser *i_outparser);
+
+               
+
+       
+               // Test if we need to check the "dicom" tag if it exists on database
+               void setDB(const std::string i_db, const std::string i_table);
+
+               const std::string getTag();
+
+       
+       private:
+
+               OutputModelParser *m_outparser;
+
+               // dimensions of output
+               int dim;
+
+               // index to indicate if one model is available to perform sorting
+               bool bmodel;
+               
+               // index to indicate of a "DICOM" tag is selected to perform sorting
+               // not necessary a dicom tag
+               // for the moment only Gimmick Tag format accepted but should be GDCM2 format or GDCM1.3 too
+               bool bDicom;
+
+               // database name
+               std::string m_dbname;
+               
+               std::string m_tag;
+#if defined(USE_GDCM)
+               //m_tag1;
+               template<typename T>
+               //void getReadValues(const std::vector<std :: string> i_filenames, std::vector<T> &o_val);
+               double orderFiles(std::vector<std::string> im, std::vector<std::string> &out);
+
+#endif
+#if defined(USE_GDCM2)
+               gdcm::Tag       m_tag2;
+
+               template<typename T>
+               void getScanValues(const std::vector<std :: string> i_filenames, const std::string i_stag, std::map<std::string,T> &o_val);
+       
+               /*template<typename T>
+               T getTypeTag();*/
+#endif
+
+               // the initial value to start sorting
+               int tag_begin;
+
+               // the final value to end sorting
+               int tag_end;
+
+               // step for the values
+               int tag_step;
+
+               // if the sorting is not the same for the set of data, we include another OutputModel
+               // ex : if we want a step = 20 for the 100 first values, next a step = 10 for the next 100 and step = 1 for the lastest value
+               OutputModel *m_model;
+
+               // indicates if the sorting tag is present in database or not
+               bool b_db;
+
+               std::string m_db;
+
+               std::string m_table;
+
+               template<typename T>
+               void getValues(const std::vector<std::string> i_filenames,const std::string i_tag, std::map< std::string, T> &o_val);
+               template<typename T>
+               void getDBValues(const std::vector<std::string> i_filenames, const std::string i_stag, std::map<std::string,T> &o_val);
+
+               void sort(const std::vector<std::string> i_filenames, std::vector<std::string> &o_sort, int level);
+
+               bool checkModel(std::map<std::string, std::string> i_model, const std::string i_val);
+#endif
+       };
+                template <class T>
+        class OutputSort
+        {
+        public :
+                std::map <std::string, T> values;
+                std::map<std::string, T> tags;
+
+                void setTag(T i_tag, const std::string name)
+                {
+                        tags[name] = i_tag;
+                }
+
+                void sort (const std::map<std::string, T> i_values, std::vector<std::string> &o_sort)
+                {
+                        for(T index = tags[OUTPUTMODEL_TAG(0)]; index <= tags[OUTPUTMODEL_TAG(1)]; index += tags[OUTPUTMODEL_TAG(2)])
+                       {
+                               std::map<std::string, T>::const_iterator it_val = i_values.begin();
+                               for(;it_val != values.end(); it_val++)
+                               {
+                                       if(it_val->second.c_str()  == index)
+                                       {
+                                               o_sort.push_back(it_val->first.c_str());
+                                               break;
+                                       }
+                               }
+                        }
+                }
+        };
+} // namespace creaImageIO
+#endif //__creaImageIOoutputModel_h_INCLUDED__
\ No newline at end of file
index 05b2da963c6649d8aa6bfb3ba59d922c3b89722e..a820960acf2e9c62b063cfa3523d6b871238d915 100644 (file)
@@ -1,6 +1,7 @@
 #include <creaImageIOWxDumpPanel.h>
 #include <creaImageIOSystem.h>
 #include <creaImageIOGimmick.h>
+#include <boost/algorithm/string.hpp>
 #if defined(USE_GDCM)
 #include <gdcmGlobal.h>
 #include <gdcmDictSet.h>
@@ -15,6 +16,8 @@
 #include "gdcmDictPrinter.h"
 #include "gdcmPrinter.h"
 #include "gdcmReader.h"
+#include "gdcmSmartPointer.h"
+#include "gdcmSequenceOfItems.h"
 #endif
 #include "icons/save.xpm"
 
@@ -79,6 +82,76 @@ namespace creaImageIO
                          printer.Print( os );
                          result = os.str();
                  }
+
+
+
+       //const gdcm::DataSet& ds = reader.GetFile().GetDataSet();
+ // // (5400,0100) SQ (Sequence with undefined length #=1)     # u/l, 1 WaveformSequence
+       // gdcm::Tag twsq(0x5400,0x0100);
+       // bool btest = ds.FindDataElement( twsq) ;
+       //const gdcm::DataElement &wsq = ds.GetDataElement( twsq );
+       // gdcm::SmartPointer<gdcm::SequenceOfItems> sqi = wsq.GetValueAsSQ();
+       // int num = sqi->GetNumberOfItems();
+ // 
+ // const gdcm::Item & item = sqi->GetItem(1); // Item start at #1
+ // const gdcm::DataSet& nestedds = item.GetNestedDataSet();
+
+ // // (5400,1004) US 16                                       #   2, 1 WaveformBitsAllocated
+ // gdcm::Tag twba(0x5400,0x1004);
+ // if( !nestedds.FindDataElement( twba ) )
+ //   {
+ // 
+ //   }
+ // const gdcm::DataElement &wba= nestedds.GetDataElement( twba );
+
+ // //std::cout << wba << std::endl;
+ // //  (5400,1006) CS [SS]                                     #   2, 1 WaveformSampleInterpretation
+ // // (5400,1010) OW 00ba\0030\ff76\ff8b\00a2\ffd3\ffae\ff50\0062\00c4\011e\00c2\00ba... # 57600, 1 WaveformData
+ // gdcm::Tag twd(0x5400,0x1010);
+ // if( !nestedds.FindDataElement( twd ) )
+ //   {
+
+ //   }
+ // const gdcm::DataElement &wd = nestedds.GetDataElement( twd );
+ // const gdcm::ByteValue *bv = wd.GetByteValue();
+ // size_t len = bv->GetLength();
+ // int16_t *p = (int16_t*)bv;
+       // 
+ // size_t npts = len / 2;
+ // //npts = 10; // DEBUG !
+ // for(size_t i = 0; i < npts; ++i )
+ //   {
+ //   float x;
+ //   x = (float)p[i];
+ //   }
+ //// 
+       //// gdcm::SmartPointer<gdcm::SequenceOfItems> sqi = wsq.GetValueAsSQ();
+       ////if( !sqi || !sqi->GetNumberOfItems() )
+ ////   {
+ ////   
+ ////   }
+
+ //// const gdcm::Item & item = sqi->GetItem(1); // Item start at #1
+ //// const gdcm::DataSet& nestedds = item.GetNestedDataSet();
+
+ //// // (5400,1004) US 16                                       #   2, 1 WaveformBitsAllocated
+ //// gdcm::Tag twba(0x5400,0x1004);
+ //// if( !nestedds.FindDataElement( twba ) )
+ ////   {
+ ////   return 0;
+ ////   }
+ //// const gdcm::DataElement &wba= nestedds.GetDataElement( twba );
+
+
+
+       //        gdcm::DataElement data = reader.GetFile().GetDataSet().GetDataElement(gdcm::Tag(0x5400,0x0100));
+       //        std::string seq_old_begin = "(fffe,e000) na (Item with undefined length)";
+       //        std::string seq_new_begin = "<SEQ>";
+       //        boost::algorithm::replace_all(result, seq_old_begin, seq_new_begin);
+       //        std::string seq_old_end = "(fffe,e00d)";
+       //        std::string seq_new_end = "<\\SEQ>";
+       //        boost::algorithm::replace_all(result, seq_old_end, seq_new_end);
+                 //seq_old_end = "(fffe,e0dd)";                  boost::algorithm::replace_all(result, seq_old_end, "\n");
 #endif
                  DumpText->SetValue(crea::std2wx(result));                
 
diff --git a/src/creaImageIOWxOutputDlg.cpp b/src/creaImageIOWxOutputDlg.cpp
new file mode 100644 (file)
index 0000000..a927191
--- /dev/null
@@ -0,0 +1,147 @@
+#include <creaImageIOWxOutputDlg.h>
+
+namespace creaImageIO
+{
+       // CTor
+   WxOutputDlg::WxOutputDlg(wxWindow *parent, const std::vector<std::string> filenames, int i_dim, bool single)
+    : wxDialog(parent, -1,_T("OUTPUT FORMAT"), wxDefaultPosition, wxSize(350,450))
+   {
+
+               int size = filenames.size();
+               
+               int deflt = 1;
+
+               std::string sentence;
+               sentence = "You select";
+               std::string sentence2 = "You have the possibility to select output format :";
+               int nbsent= 0;
+               std::vector<std::string> outsentences;
+               if (size == 1)
+               {
+                  sentence += " 1 ";
+               }
+               else
+               {
+                  sentence += " n ";
+               }
+               if(single)
+               {
+                       sentence += " single frames";
+               }
+               else
+               {
+                       sentence += " multi-frames"; 
+               }
+               sentence += " as output";
+         
+               
+               if (size == 1)
+               {
+                       if(single)
+                       {
+                               outsentences.push_back("It shall be a single file with a single 2D frmae");
+                       }
+                       else
+                       {
+                               outsentences.push_back("It shall be  multiple files with 2D frames");
+                               outsentences.push_back("It shall be a single file with 3D frames");
+                       }                       
+               }
+               else
+               {
+                       if(single)
+                       {
+                               outsentences.push_back("It shall be a single file with 3D frames");
+                               outsentences.push_back("It shall be  multiple files with 2D frames");
+                       }
+                       else
+                       {
+                               outsentences.push_back("It shall be a single file with (3D+t) frames");
+                               outsentences.push_back("It shall be  multiple (n+t) files with 2D frames");
+                               outsentences.push_back("It shall be  multiple (n) files with (2D+t) frames");
+                               outsentences.push_back("It shall be a multiple (t) files with (2D+n) frames");
+                               deflt = 3;
+                       }
+               
+               }
+               if(i_dim != -1)
+               {
+                       deflt = i_dim;
+               }
+
+
+         int start_point = 45;
+         wxStaticText * ExportText=new wxStaticText(this,-1,_T(sentence), wxPoint(5,10));
+         
+         std::vector<std::string>::iterator it = outsentences.begin();
+         for(int i = 0;it != outsentences.end(); it++, i++, start_point += 45)
+         {
+                wxCheckBox *check = new wxCheckBox(this, -1, _T((*it)), wxPoint(5,start_point) );
+                if(i == deflt)
+                        check->SetValue(true);
+                else
+                        check->SetValue(false);
+                 Connect( check->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &WxOutputDlg::OnChange );
+                 checkOut.push_back(check);
+         }
+         
+        checkAsking = new wxCheckBox(this, -1, _T(("Do you want to save this output and no more asking")), wxPoint(5,start_point) );
+
+         // VALIDATION BUTTON
+         wxButton *Ok = new wxButton(this, -1,_T("OK"), wxPoint(5,start_point+20) );
+         Connect( Ok->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WxOutputDlg::OnOk ); 
+       
+         wxButton *Cancel = new wxButton(this, wxID_CANCEL,_T("CANCEL"), wxPoint(100,start_point+20) );
+         Layout(); 
+         
+       }
+
+       WxOutputDlg::~WxOutputDlg(){}
+
+       void WxOutputDlg::OnOk(wxCommandEvent &event)
+       {
+               Close();
+               SetReturnCode(wxID_OK);
+       }       
+
+       void WxOutputDlg::OnChange(wxCommandEvent& event)
+       {
+               std::vector<wxCheckBox*>::iterator it = checkOut.begin();
+
+               for(int i = 0;it != checkOut.end(); it++, i++)
+               {
+                       if( (*it)->GetId() == event.GetId())
+                       {
+                       }
+                       else
+                       {
+                               (*it)->SetValue(false);
+                       }
+               }
+       }
+
+       const std::string WxOutputDlg::getDim()
+       {
+               char res[2];
+               std::vector<wxCheckBox*>::iterator it = checkOut.begin();
+           for(int i = 1;it != checkOut.end(); it++, i++)
+           {
+                       if( (*it)->GetValue() )
+                       {
+                               sprintf(res,"%d", i);
+                       }
+                       else
+                       {
+                               
+                       }
+               }
+               return res;
+       }
+       const std::string WxOutputDlg::getAsking()
+       { 
+               if(checkAsking->GetValue())
+                       return "false"; 
+               else
+                       return "true";
+       }
+}
diff --git a/src/creaImageIOWxOutputDlg.h b/src/creaImageIOWxOutputDlg.h
new file mode 100644 (file)
index 0000000..19cac52
--- /dev/null
@@ -0,0 +1,44 @@
+#ifndef __creaImageIOWxOutputDlg_h_INCLUDED__
+#define __creaImageIOOutputtDlg_h_INCLUDED__
+
+#ifdef USE_WXWIDGETS
+#include <creaWx.h>
+#include <creaImageIOWxGimmickView.h>
+
+
+
+namespace creaImageIO{
+       /**
+   * \ingroup GUI
+   */
+  //=====================================================================
+ //=====================================================================
+ /// WxOutputDlg allows to select the different output format
+ ///
+       class WxOutputDlg : public wxDialog
+       {
+       public:
+               ///CTor
+               WxOutputDlg (wxWindow *parent, const std::vector<std::string> filenames, int i_dim, bool single);
+               ///DTor
+               ~WxOutputDlg();
+
+       /// Get selected storage
+       const std::string getAsking();
+       const std::string getDim();
+       
+       private:
+
+               ///Validate selected storage
+               void OnOk(wxCommandEvent &event);
+
+               std::vector<wxCheckBox*> checkOut;
+               void OnChange(wxCommandEvent& event);
+
+               wxCheckBox      *checkAsking;
+
+       };
+}
+#endif // USE_WIDGETS
+// EOF
+#endif// __creaImageIOWxOutputDlg_h_INCLUDED__