This file is indexed.

/usr/include/gdcm-2.0/gdcmWriter.h is in libgdcm2-dev 2.0.18-7.

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
/*=========================================================================

  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 GDCMWRITER_H
#define GDCMWRITER_H

#include "gdcmFile.h"

namespace gdcm
{

class FileMetaInformation;
/**
 * \brief Writer ala DOM (Document Object Model)
 * This class is a non-validating writer, it will only performs well-
 * formedness check only.
 *
 * \details Detailled description here
 * To avoid GDCM being yet another broken DICOM lib we try to
 * be user level and avoid writing illegal stuff (odd length,
 * non-zero value for Item start/end length ...)
 * Therefore you cannot (well unless you are really smart) write
 * DICOM with even length tag.
 * All the checks are consider basics:
 * - Correct Meta Information Header (see gdcm::FileMetaInformation)
 * - Zero value for Item Length (0xfffe, 0xe00d/0xe0dd)
 * - Even length for any elements
 * - Alphabetical order for elements (garanteed by design of internals)
 * - 32bits VR will be rewritten with 00
 *
 * \warning
 * gdcm::Writer cannot write a DataSet if no SOP Instance UID (0008,0018) is found,
 * unless a DICOMDIR is being written out
 *
 * \see Reader DataSet File
 */
class GDCM_EXPORT Writer
{
public:
  Writer();
  virtual ~Writer();

  /// Main function to tell the writer to write
  virtual bool Write(); // Execute()

  /// Set the filename of DICOM file to write:
  void SetFileName(const char *filename) {
    //std::cerr << "Stream: " << filename << std::endl;
    //std::cerr << "Ofstream: " << Ofstream << std::endl;
    if (Ofstream && Ofstream->is_open())
      {
      Ofstream->close();
      delete Ofstream;
      }
    Ofstream = new std::ofstream();
    Ofstream->open(filename, std::ios::out | std::ios::binary );
    assert( Ofstream->is_open() );
    assert( !Ofstream->fail() );
    //std::cerr << Stream.is_open() << std::endl;
    Stream = Ofstream;
  }
  /// Set user ostream buffer
  void SetStream(std::ostream &output_stream) {
    Stream = &output_stream;
  }

  /// Set/Get the DICOM file (DataSet + Header)
  void SetFile(const File& f) { F = f; }
  File &GetFile() { return *F; }

  /// Undocumented function, do not use (= leave default)
  void SetCheckFileMetaInformation(bool b) { CheckFileMetaInformation = b; }
  void CheckFileMetaInformationOff() { CheckFileMetaInformation = false; }
  void CheckFileMetaInformationOn() { CheckFileMetaInformation = true; }

protected:
  void SetWriteDataSetOnly(bool b) { WriteDataSetOnly = b; }

protected:
  friend class StreamImageWriter;
  //this function is added for the StreamImageWriter, which needs to write
  //up to the pixel data and then stops right before writing the pixel data.
  //after that, for the raw codec at least, zeros are written for the length of the data
  std::ostream* GetStreamPtr() const { return Stream; }

protected:
  std::ostream *Stream;
  std::ofstream *Ofstream;

private:
  SmartPointer<File> F;
  bool CheckFileMetaInformation;
  bool WriteDataSetOnly;
};

} // end namespace gdcm

#endif //GDCMWRITER_H