]> Creatis software - creaImageIO.git/blobdiff - src2/creaImageIOGimmickView.h
Changed validation methods from TreeView to GimmickView (Abstract)
[creaImageIO.git] / src2 / creaImageIOGimmickView.h
index a521f8de820c75a4053fa08102dc1e4f52bbb138..62dc2d12ee8df2328fecbf6aa964a306c01dc0b9 100644 (file)
@@ -7,6 +7,7 @@
 
 //#include <map>
 #include <vtkImageData.h>
+#include <creaImageIOMultiThreadImageReader.h>
 
 #define GIMMICK_NO_IMAGE_SELECTION 0
 #define GIMMICK_2D_IMAGE_SELECTION 2
@@ -27,11 +28,11 @@ namespace creaImageIO
     
     //=====================================================================
     ///Abstract class that handles views, attributes and previews (GUI) for Gimmick.
-       class GimmickView
+       class GimmickView: public MultiThreadImageReaderUser
     {
     public:
       /// Ctor
-      GimmickView(Gimmick* );
+      GimmickView(Gimmick*, int number_of_threads = 0 );
       /// Virtual destructor
       virtual ~GimmickView();
 
@@ -53,12 +54,26 @@ namespace creaImageIO
 
       /// Finalize 
       virtual void Finalize();
+
          ///Returns the selected Images and validates to see if they comply with the given parameter(<4D)
          vtkImageData* GetSelectedImage(int dim);
       ///Adds the selected Images to the given vector and validates to see if they comply with the given parameter (4D)
-      virtual void GetSelectedImages(std::vector<vtkImageData*>& s, int dim) {}
+      virtual void GetSelectedImages(std::vector<vtkImageData*>& s, int dim) 
+         { GimmickError("INTERNAL ERROR : GetSelectedImages not implemented"); }
+
+         virtual void GetSelectedFiles(std::vector<std::string>& s)
+         { GimmickError("INTERNAL ERROR : GetSelectedFiles not implemented"); }
+
+         ///Validates the dimension compliance of the images with the maximum and minimum given, and between their sizes
+         bool ValidateSelected (std::vector<tree::Node*>& sel, int min_dim, int max_dim);
+
+         ///Reads the vector of nodes, builds images in the dimension required and returns them in the supplied vector.
+         void ReadImagesNotThreaded(std::vector<vtkImageData*>& s,std::vector<tree::Node*> im, int dim);
 
-      virtual void GetSelectedFiles(std::vector<std::string>& s) {}
+         ///Obtains the message of the state
+         std::string GetMessage(){return mMess;}
+         ///Obtains the message of the state
+         void SetMessage(std::string mess){mMess=mess;}
 
       /// Create the tree views 
       void CreateTreeViews();
@@ -76,6 +91,11 @@ namespace creaImageIO
       Gimmick* mGimmick;
       /// The views 
       TreeViewMapType mTreeViewMap;
+         /// The message that results from the validation
+         std::string mMess;
+         /// Multi-thread image reader
+         MultiThreadImageReader mReader;
+         
       
     };
     // EO class GimmickView