gdcmReader.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef __gdcmReader_h
00017 #define __gdcmReader_h
00018
00019 #include "gdcmFile.h"
00020
00021 #include <fstream>
00022
00023 namespace gdcm
00024 {
00053 class GDCM_EXPORT Reader
00054 {
00055 public:
00056 Reader():F(new File){
00057 Stream = NULL;
00058 Ifstream = NULL;
00059 }
00060 virtual ~Reader();
00061
00062 virtual bool Read();
00063 void SetFileName(const char *filename) {
00064 if(Ifstream) delete Ifstream;
00065 Ifstream = new std::ifstream();
00066 Ifstream->open(filename, std::ios::binary);
00067 Stream = Ifstream;
00068 }
00069 void SetStream(std::istream &input_stream) {
00070 Stream = &input_stream;
00071 }
00072
00073 const File &GetFile() const { return *F; }
00074 File &GetFile() { return *F; }
00075 void SetFile(File& file) { F = &file; }
00076
00077
00078 bool ReadUpToTag(const Tag & tag, std::set<Tag> const & skiptags);
00079
00080 protected:
00081 bool ReadPreamble();
00082 bool ReadMetaInformation();
00083 bool ReadDataSet();
00084
00085 SmartPointer<File> F;
00086
00087 private:
00088 TransferSyntax GuessTransferSyntax();
00089 std::istream *Stream;
00090 std::ifstream *Ifstream;
00091 };
00092
00099 }
00100
00101
00102 #endif //__gdcmReader_h