GDCM  2.2.3
gdcmStreamImageReader.h
Go to the documentation of this file.
00001 /*=========================================================================
00002  *
00003  *  Copyright Insight Software Consortium
00004  *
00005  *  Licensed under the Apache License, Version 2.0 (the "License");
00006  *  you may not use this file except in compliance with the License.
00007  *  You may obtain a copy of the License at
00008  *
00009  *         http://www.apache.org/licenses/LICENSE-2.0.txt
00010  *
00011  *  Unless required by applicable law or agreed to in writing, software
00012  *  distributed under the License is distributed on an "AS IS" BASIS,
00013  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  *  See the License for the specific language governing permissions and
00015  *  limitations under the License.
00016  *
00017  *=========================================================================*/
00018 #ifndef GDCMSTREAMIMAGEREADER_H
00019 #define GDCMSTREAMIMAGEREADER_H
00020 
00021 #include "gdcmReader.h"
00022 
00023 namespace gdcm
00024 {
00025 
00026 class MediaStorage;
00038 class GDCM_EXPORT StreamImageReader
00039 {
00040 
00041 public:
00042   StreamImageReader();
00043   virtual ~StreamImageReader();
00044 
00048   void SetFileName(const char* inFileName);
00049   void SetStream(std::istream& inStream);
00050 
00051   std::vector<unsigned int> GetDimensionsValueForResolution( unsigned int  );
00052 
00060   void DefinePixelExtent(uint16_t inXMin, uint16_t inXMax,
00061     uint16_t inYMin, uint16_t inYMax, uint16_t inZMin = 0, uint16_t inZMax = 1);
00062 
00067   uint32_t DefineProperBufferLength() const;
00068 
00076   bool Read(char* inReadBuffer, const std::size_t& inBufferLength);
00077 
00083   bool CanReadImage() const;
00084 
00088   virtual bool ReadImageInformation();
00089 
00093   File const & GetFile() const;
00094 
00095 protected:
00096 private:
00097   //contains a reader for being able to ReadUpToTag
00098   //however, we don't want the user to be able to call Read
00099   //either directly or via a parent class call, so we hide the reader in here.
00100   Reader mReader;
00101 
00102   std::streamoff mFileOffset; //the file offset for getting header information
00103   std::streamoff mFileOffset1;
00104   DataSet mHeaderInformation; //all the non-pixel information
00105 
00106   //for thread safety, these should not be stored here, but should be used
00107   //for every read subregion operation.
00108   uint16_t mXMin, mYMin, mXMax, mYMax, mZMin, mZMax;
00109 
00114   bool ReadImageSubregionRAW(char* inReadBuffer, const std::size_t& inBufferLength);
00115 
00118   bool ReadImageSubregionJpegLS(char* inReadBuffer, const std::size_t& inBufferLength);
00119 };
00120 
00121 } // end namespace gdcm
00122 
00123 #endif //GDCMSTREAMIMAGEREADER_H
00124 

Generated on Thu Nov 28 2013 07:02:50 for GDCM by doxygen 1.7.6.1
SourceForge.net Logo