/usr/include/gdcm-2.4/gdcmReader.h is in libgdcm2-dev 2.4.4-3+deb8u1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | /*=========================================================================
Program: GDCM (Grassroots DICOM). A DICOM library
Copyright (c) 2006-2011 Mathieu Malaterre
All rights reserved.
See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
#ifndef GDCMREADER_H
#define GDCMREADER_H
#include "gdcmFile.h"
#include <fstream>
namespace gdcm
{
class StreamImageReader;
/**
* \brief Reader ala DOM (Document Object Model)
*
* \details This class is a non-validating reader, it will only performs well-
* formedness check only, and to some extent catch known error (non
* well-formed document).
*
* Detailled description here
*
* A DataSet DOES NOT contains group 0x0002 (see FileMetaInformation)
*
* This is really a DataSet reader. This will not make sure the dataset conform
* to any IOD at all. This is a completely different step. The reasoning was
* that user could control the IOD there lib would handle and thus we would not
* be able to read a DataSet if the IOD was not found Instead we separate the
* reading from the validation.
*
* \note
* From GDCM1.x. Users will realize that one feature is missing
* from this DOM implementation. In GDCM 1.x user used to be able to
* control the size of the Value to be read. By default it was 0xfff.
* The main author of GDCM2 thought this was too dangerous and harmful and
* therefore this feature did not make it into GDCM2
*
* \warning
* GDCM will not produce warning for unorder (non-alphabetical order).
*
* \see Writer FileMetaInformation DataSet File
*/
class GDCM_EXPORT Reader
{
public:
Reader():F(new File){
Stream = NULL;
Ifstream = NULL;
}
virtual ~Reader();
/// Main function to read a file
virtual bool Read(); // Execute()
/// Set the filename to open. This will create a std::ifstream internally
/// See SetStream if you are dealing with different std::istream object
void SetFileName(const char *filename_native);
/// Set the open-ed stream directly
void SetStream(std::istream &input_stream) {
Stream = &input_stream;
}
/// Set/Get File
const File &GetFile() const { return *F; }
/// Set/Get File
File &GetFile() { return *F; }
/// Set/Get File
void SetFile(File& file) { F = &file; }
/// Will read only up to Tag \param tag and skipping any tag specified in
/// \param skiptags
bool ReadUpToTag(const Tag & tag, std::set<Tag> const & skiptags = std::set<Tag>() );
/// Will only read the specified selected tags.
bool ReadSelectedTags(std::set<Tag> const & tags, bool readvalues = true);
/// Will only read the specified selected private tags.
bool ReadSelectedPrivateTags(std::set<PrivateTag> const & ptags, bool readvalues = true);
/// Test whether this is a DICOM file
/// \warning need to call either SetFileName or SetStream first
bool CanRead() const;
/// For wrapped language. return type is compatible with System::FileSize return type
/// Use native std::streampos / std::streamoff directly from the stream from C++
size_t GetStreamCurrentPosition() const;
protected:
bool ReadPreamble();
bool ReadMetaInformation();
bool ReadDataSet();
SmartPointer<File> F;
friend class StreamImageReader; //need to be friended to be able to grab the GetStreamPtr
//this function is added for the StreamImageReader, which needs to read
//up to the pixel data and then stops right before reading the pixel data.
//it's used to get that position, so that reading can continue
//apace once the read function is called.
//so, this function gets the stream directly, and then allows for position information
//from the tellg function, and allows for stream/pointer manip in order
//to read the pixel data. Note, of course, that reading pixel elements
//will still have to be subject to endianness swaps, if necessary.
std::istream* GetStreamPtr() const { return Stream; }
private:
template <typename T_Caller>
bool InternalReadCommon(const T_Caller &caller);
TransferSyntax GuessTransferSyntax();
std::istream *Stream;
std::ifstream *Ifstream;
};
/**
* \example TestReader.cxx
* \example TestReader.py
* This is a C++ example on how to use gdcm::Reader
*/
} // end namespace gdcm
#endif //GDCMREADER_H
|