#include <wx/thread.h>
#include <queue>
+
+
namespace creaImageIO
{
-
+ /**
+ * \ingroup IO
+ */
//=====================================================================
class ThreadedImageReader;
class MultiThreadImageReader;
//=====================================================================
///
/// TAKE CARE : For the moment it only supports a **SINGLE USER**
+
+ ///Class that allows parallel lectures of several images
class MultiThreadImageReader : public MultiThreadImageReaderUser
{
public:
int priority );
/// Request the image "filename" immediately
- /// (no callback but image returned)
+ /// Blocks until image loaded
+ /// (no user callback but image returned)
vtkImageData* GetImage(const std::string& filename);
///
void OnMultiThreadImageReaderEvent( const std::string& filename,
EventType type,
vtkImageData* image);
-
+
+ /// Function to read attributes for a file
+ void getAttributes(const std::string filename, std::map <std::string , std::string> &infos, std::vector<std::string> i_attr);
+
protected:
+ bool mDone;
int GetMaximalPriorityWithoutLocking();
- //
+ ///Class that represents an image to be loaded
class ImageToLoad
{
public:
int& UnloadIndex() { return mUnloadIndex; }
vtkImageData* GetImage() const { return mImage; }
void SetImage( vtkImageData* i ) { mImage=i; }
+
+ std::map<std::string, std::string> getAttributes(const std::vector<std::string> i_attr);
private:
MultiThreadImageReaderUser* mUser;
std::string mFilename;
ImageToLoadPtrIndexer> mQueue;
/// The type of list of threaded readers
- typedef std::vector<ThreadedImageReader*> ThreadedImageReaderListType;
+ typedef std::vector<boost::shared_ptr<ThreadedImageReader> > ThreadedImageReaderListType;
+ //typedef std::vector<ThreadedImageReader* > ThreadedImageReaderListType;
ThreadedImageReaderListType mThreadedImageReaderList;
/// The number of currently running threaded readers
int mNumberOfThreadedReadersRunning;