MeVisLabToolboxReference
MeVis/Foundation/Sources/DicomTree/MLDicomTree/DCMTree_MFPixelTag.h
Go to the documentation of this file.
00001 // **InsertLicense** code
00002 //-----------------------------------------------------------------------------
00003 
00004 #ifndef DCMTREE_PIXELTAG_H
00005 #define DCMTREE_PIXELTAG_H
00006 
00007 #include <cstddef>
00008 #include <string>
00009 
00010 #include <boost/shared_array.hpp>
00011 #include <boost/shared_ptr.hpp>
00012 
00013 #include "DCMTree_Tag.h"
00014 #include "DCMTree_Value.h"
00015 #include "DCMTree_TagId.h"
00016 #include "DCMTree_FileCache.h"
00017 
00018 
00019 namespace DCMTree
00020 {
00021   // This class manages pixel data access of DICOM multiframe images
00022   // pixel data is not loaded to memory on creation but can be loaded 
00023   // demand to a user defined and controlled buffer.
00024   // This class is an abstract class because the file handling differs
00025   // for different parsers - for the moment dcmtk from OFFIS is supported
00026   class DCMTREE_EXPORT MFPixelTag : public Tag
00027   {
00028   public:
00029     typedef boost::shared_array<unsigned char> pixel_cont_t;
00030     typedef boost::shared_ptr<FileCache> file_cache_t;
00031     
00032     MFPixelTag(TagInfo const & tagInfo,
00033              std::string const & filename,
00034              boost::uint32_t value_count,
00035              boost::uint32_t value_size);
00036     
00037     virtual ~MFPixelTag();
00038 
00039     virtual file_cache_t createFileCache() const =0;
00040     virtual pixel_cont_t getFrame(boost::uint32_t idx) =0;
00041     virtual pixel_cont_t getFrame(boost::uint32_t idx, FileCache *cache) =0;
00042     virtual pixel_cont_t getFrame(boost::uint32_t idx, std::string & colorModel, unsigned int & fragment) =0;
00043     virtual pixel_cont_t getFrame(boost::uint32_t idx, std::string & colorModel, unsigned int & fragment, 
00044                                   DCMTree::FileCache *cache) =0;
00045     virtual boost::uint32_t numberOfFrames() const;
00046     virtual boost::uint32_t frameSize() const;
00047 
00048     // ----- DCMTree_Tag Interface -----
00049     // has a reasonable meaning and therefore a reasonable implementation
00050     virtual boost::uint32_t numberOfValues() const;
00051     virtual boost::uint32_t getValueSize (unsigned int) const;
00052     virtual boost::uint32_t getValueSize () const;
00053 
00054     // for these functions there is no reasonable semantic in the multiframe case
00055     virtual Value &addValue();
00056     virtual void fromStream (std::istream &);
00057     virtual void toStream (std::ostream &) const;
00058     // addValue - schwierig, weil es eine Referenz auf ein Value-Objekt zurueck gibt
00059     // setValue - ok, rangeChecking wirft Exception
00060     // Value & getValue(); - ok, rangeChecking wirft Exception
00061     // deepCopy  kann funktionieren
00062     // toString ? to...
00063     // de-/serialize - wird nicht gebraucht, kann aber funktionieren
00064     // compare ?
00065   protected:
00066     boost::uint32_t valueCount() const { return value_count_; }
00067     boost::uint32_t valueSize()  const { return value_size_; }
00068     std::string const &  filename()  const { return filename_; }
00069     
00070   private:
00071     boost::uint32_t value_count_;
00072     boost::uint32_t value_size_;
00073     std::string filename_;
00074   };
00075 
00076 }
00077 
00078 #endif