<commit_before>/*=========================================================================

  Program: DICOM for VTK

  Copyright (c) 2012-2013 <NAME>
  All rights reserved.
  See Copyright.txt or http://www.cognitive-antics.net/bsd3.txt 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 __vtkDICOMCompiler_h
#define __vtkDICOMCompiler_h

#include <vtkObject.h>
#include "vtkDICOMModule.h"

class vtkDICOMMetaData;
class vtkDICOMCompilerInternalFriendship;

//! A writer for DICOM meta data.
/*!
 *  This class provides routines for compiling a a vtkDICOMMetaData
 *  object into a DICOM file.
 */
class VTK_DICOM_EXPORT vtkDICOMCompiler : public vtkObject
{
public:
  //! Create a new vtkDICOMCompiler instance.
  static vtkDICOMCompiler *New();

  //! VTK dynamic type information macro.
  vtkTypeMacro(vtkDICOMCompiler, vtkObject);

  //! Print a summary of the contents of this object.
  void PrintSelf(ostream& os, vtkIndent indent);

  //! Set the file name.
  vtkSetStringMacro(FileName);
  vtkGetStringMacro(FileName);

  //! Set the metadata object to write to the file.
  void SetMetaData(vtkDICOMMetaData *);
  vtkDICOMMetaData *GetMetaData() { return this->MetaData; }

  //! Set the instance index to use when accessing vtkDICOMMataData.
  vtkSetMacro(Index, int);
  int GetIndex() { return this->Index; }

  //! Set the buffer size, the default is 8192 (8k).
  /*!
   *  A larger buffer size results in fewer IO calls.  The
   *  minimum buffer size is 256 bytes.
   */
  void SetBufferSize(int size);
  int GetBufferSize() { return this->BufferSize; }

  //! Write the metadata to the file.
  virtual void WriteHeader();

  //! Write all of the pixel data in one go.
  /*!
   *  This method assumes that the supplied buffer is already in
   *  the correct format (endianness, compression, fragments, etc)
   *  and writes it out to the file as a PixelData element.
   */
  virtual void WritePixelData(const char *cp, vtkIdType size);

  //! Write one frame.
  virtual void WriteFrame(const char *cp, vtkIdType size);

  //! Close the file.
  virtual void Close();

  //! Get the IO error code.
  unsigned long GetErrorCode() { return this->ErrorCode; }

  //! Use the original PixelData VR when writing pixel data element.
  /*!
   *  This is really only useful when cloning data sets.  It ensures
   *  that the written data uses the same VR as the original data.
   */
  vtkSetMacro(KeepOriginalPixelDataVR, int);
  vtkBooleanMacro(KeepOriginalPixelDataVR, int);
  vtkGetMacro(KeepOriginalPixelDataVR, int);

protected:
  vtkDICOMCompiler();
  ~vtkDICOMCompiler();

  //! Internal method for flushing the IO buffer.
  /*!
   *  This is an internal method that flushes the buffer to the file.
   *  The pointer cp markes the current position in the buffer, and
   *  ep marks the end of the buffer.  By checking ep-cp, subroutines
   *  can check how much space is left in the buffer and call FlushBuffer<commit_msg>Fix documentation typos in header file.<commit_after>/*=========================================================================

  Program: DICOM for VTK

  Copyright (c) 2012-2013 <NAME>
  All rights reserved.
  See Copyright.txt or http://www.cognitive-antics.net/bsd3.txt 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 __vtkDICOMCompiler_h
#define __vtkDICOMCompiler_h

#include <vtkObject.h>
#include "vtkDICOMModule.h"

class vtkDICOMMetaData;
class vtkDICOMCompilerInternalFriendship;

//! A writer for DICOM meta data.
/*!
 *  This class provides routines for compiling a vtkDICOMMetaData
 *  object into a DICOM file.
 */
class VTK_DICOM_EXPORT vtkDICOMCompiler : public vtkObject
{
public:
  //! Create a new vtkDICOMCompiler instance.
  static vtkDICOMCompiler *New();

  //! VTK dynamic type information macro.
  vtkTypeMacro(vtkDICOMCompiler, vtkObject);

  //! Print a summary of the contents of this object.
  void PrintSelf(ostream& os, vtkIndent indent);

  //! Set the file name.
  vtkSetStringMacro(FileName);
  vtkGetStringMacro(FileName);

  //! Set the metadata object to write to the file.
  void SetMetaData(vtkDICOMMetaData *);
  vtkDICOMMetaData *GetMetaData() { return this->MetaData; }

  //! Set the instance index to use when accessing vtkDICOMMataData.
  vtkSetMacro(Index, int);
  int GetIndex() { return this->Index; }

  //! Set the buffer size, the default is 8192 (8k).
  /*!
   *  A larger buffer size results in fewer IO calls.  The
   *  minimum buffer size is 256 bytes.
   */
  void SetBufferSize(int size);
  int GetBufferSize() { return this->BufferSize; }

  //! Write the metadata to the file.
  virtual void WriteHeader();

  //! Write all of the pixel data in one go.
  /*!
   *  This method assumes that the supplied buffer is already in
   *  the correct format (endianness, compression, fragments, etc)
   *  and writes it out to the file as the PixelData value.
   */
  virtual void WritePixelData(const char *cp, vtkIdType size);

  //! Write one frame to the end of the file.
  virtual void WriteFrame(const char *cp, vtkIdType size);

  //! Close the file.
  virtual void Close();

  //! Get the IO error code.
  unsigned long GetErrorCode() { return this->ErrorCode; }

  //! Use the original PixelData VR when writing pixel data element.
  /*!
   *  This is really only useful when cloning data sets.  It ensures
   *  that the written data uses the same VR as the original data.
   */
  vtkSetMacro(KeepOriginalPixelDataVR, int);
  vtkBooleanMacro(KeepOriginalPixelDataVR, int);
  vtkGetMacro(KeepOriginalPixelDataVR, int);

protected:
  vtkDICOMCompiler();
  ~vtkDICOMCompiler();

  //! Internal method for flushing the IO buffer.
  /*!
   *  This is an internal method that flushes the buffer to the file.
   *  The pointer cp markes the current position in the buffer, and
   *  ep marks the end of the buffer.  By checking ep-cp, subroutines
   *  can check how much space is left in the buffer and call FlushBuffer
{'fraction_non_alphanumeric': 0.1239695131435682, 'fraction_numerical': 0.005288536319800902, 'mean_word_length': 3.74188790560472, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3665701', 'n_tokens_mistral': 1928, 'n_tokens_neox': 1849, 'n_words': 721}