# CSJ2K.j2k.codestream.writer.HeaderEncoder

## Content

<div class="doc-site-dotnet-api-container">



  <h1 id="CSJ2K_j2k_codestream_writer_HeaderEncoder" data-uid="CSJ2K.j2k.codestream.writer.HeaderEncoder" class="text-break">HeaderEncoder Class
</h1>
  <div class="markdown level0 summary"><p>This class writes almost of the markers and marker segments in main header
and in tile-part headers. It is created by the run() method of the Encoder
instance.</p>
<pre><code>       &lt;p&gt;A marker segment includes a marker and eventually marker segment
       parameters. It is designed by the three letter code of the marker
       associated with the marker segment. JPEG 2000 part I defines 6 types of
       markers:
       &lt;ul&gt;&lt;li&gt;Delimiting : SOC,SOT,SOD,EOC (written in FileCodestreamWriter).&lt;/li&gt;&lt;li&gt;Fixed information: SIZ.&lt;/li&gt;&lt;li&gt;Functional: COD,COC,RGN,QCD,QCC,POC.&lt;/li&gt;&lt;li&gt; In bit-stream: SOP,EPH.&lt;/li&gt;&lt;li&gt; Pointer: TLM,PLM,PLT,PPM,PPT.&lt;/li&gt;&lt;li&gt; Informational: CRG,COM.&lt;/li&gt;&lt;/ul&gt;&lt;/p&gt;&lt;p&gt;Main Header is written when Encoder instance calls encodeMainHeader
       whereas tile-part headers are written when the EBCOTRateAllocator instance
       calls encodeTilePartHeader.&lt;/p&gt;
</code></pre>
</div>
  <div class="markdown level0 conceptual"></div>
  <div class="inheritance">
    <h5>Inheritance</h5>
    <div class="level0"><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object">object</a></div>
    <div class="level1"><span class="xref">HeaderEncoder</span></div>
  </div>
  <h6><strong>Namespace</strong>: <a class="xref" href="CSJ2K.j2k.codestream.writer.html">CSJ2K.j2k.codestream.writer</a></h6>
  <h6><strong>Assembly</strong>: C1.WPF.ReportViewer.4.6.2.dll</h6>
  <h5 id="CSJ2K_j2k_codestream_writer_HeaderEncoder_syntax">Syntax</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public class HeaderEncoder</code></pre>
  </div>
  <div class="codewrapper">
    <pre><code class="lang-vbnet hljs">Public Class HeaderEncoder</code></pre>
  </div>
  <h3 id="constructors">Constructors
</h3>
  <table class="table table-bordered table-condensed">
    <thead>
      <tr>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td id="CSJ2K_j2k_codestream_writer_HeaderEncoder__ctor_CSJ2K_j2k_image_ImgData_System_Boolean___CSJ2K_j2k_wavelet_analysis_ForwardWT_CSJ2K_j2k_image_Tiler_CSJ2K_j2k_encoder_EncoderSpecs_CSJ2K_j2k_roi_encoder_ROIScaler_CSJ2K_j2k_entropy_encoder_PostCompRateAllocator_CSJ2K_j2k_util_ParameterList_" data-uid="CSJ2K.j2k.codestream.writer.HeaderEncoder.#ctor(CSJ2K.j2k.image.ImgData,System.Boolean[],CSJ2K.j2k.wavelet.analysis.ForwardWT,CSJ2K.j2k.image.Tiler,CSJ2K.j2k.encoder.EncoderSpecs,CSJ2K.j2k.roi.encoder.ROIScaler,CSJ2K.j2k.entropy.encoder.PostCompRateAllocator,CSJ2K.j2k.util.ParameterList)">
          <a class="xref" href="CSJ2K.j2k.codestream.writer.HeaderEncoder.-ctor.html#CSJ2K_j2k_codestream_writer_HeaderEncoder__ctor_CSJ2K_j2k_image_ImgData_System_Boolean___CSJ2K_j2k_wavelet_analysis_ForwardWT_CSJ2K_j2k_image_Tiler_CSJ2K_j2k_encoder_EncoderSpecs_CSJ2K_j2k_roi_encoder_ROIScaler_CSJ2K_j2k_entropy_encoder_PostCompRateAllocator_CSJ2K_j2k_util_ParameterList_">HeaderEncoder(ImgData, bool[], ForwardWT, Tiler, EncoderSpecs, ROIScaler, PostCompRateAllocator, ParameterList)</a>
        </td>
        <td class="markdown level1 summary"><p>Initializes the header writer with the references to the coding chain.</p>
</td>
      </tr>
    </tbody>
  </table>
  <h3 id="fields">Fields
</h3>
  <table class="table table-bordered table-condensed">
    <thead>
      <tr>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td id="CSJ2K_j2k_codestream_writer_HeaderEncoder_OPT_PREFIX" data-uid="CSJ2K.j2k.codestream.writer.HeaderEncoder.OPT_PREFIX">
          <a class="xref" href="CSJ2K.j2k.codestream.writer.HeaderEncoder.OPT_PREFIX.html">OPT_PREFIX</a>
        </td>
        <td class="markdown level1 summary"><p>The prefix for the header encoder options: 'H'</p>
</td>
      </tr>
      <tr>
        <td id="CSJ2K_j2k_codestream_writer_HeaderEncoder_baos" data-uid="CSJ2K.j2k.codestream.writer.HeaderEncoder.baos">
          <a class="xref" href="CSJ2K.j2k.codestream.writer.HeaderEncoder.baos.html">baos</a>
        </td>
        <td class="markdown level1 summary"><p>The ByteArrayOutputStream to store header data. This handler is kept
in order to use methods not accessible from a general
DataOutputStream. For the other methods, it's better to use variable
hbuf.</p>
</td>
      </tr>
      <tr>
        <td id="CSJ2K_j2k_codestream_writer_HeaderEncoder_dwt" data-uid="CSJ2K.j2k.codestream.writer.HeaderEncoder.dwt">
          <a class="xref" href="CSJ2K.j2k.codestream.writer.HeaderEncoder.dwt.html">dwt</a>
        </td>
        <td class="markdown level1 summary"><p>Reference to the DWT module</p>
</td>
      </tr>
      <tr>
        <td id="CSJ2K_j2k_codestream_writer_HeaderEncoder_encSpec" data-uid="CSJ2K.j2k.codestream.writer.HeaderEncoder.encSpec">
          <a class="xref" href="CSJ2K.j2k.codestream.writer.HeaderEncoder.encSpec.html">encSpec</a>
        </td>
        <td class="markdown level1 summary"><p>The encoder specifications</p>
</td>
      </tr>
      <tr>
        <td id="CSJ2K_j2k_codestream_writer_HeaderEncoder_hbuf" data-uid="CSJ2K.j2k.codestream.writer.HeaderEncoder.hbuf">
          <a class="xref" href="CSJ2K.j2k.codestream.writer.HeaderEncoder.hbuf.html">hbuf</a>
        </td>
        <td class="markdown level1 summary"><p>The DataOutputStream to store header data. This kind of object is
useful to write short, int, .... It's constructor takes baos as
parameter.</p>
</td>
      </tr>
      <tr>
        <td id="CSJ2K_j2k_codestream_writer_HeaderEncoder_isOrigSig" data-uid="CSJ2K.j2k.codestream.writer.HeaderEncoder.isOrigSig">
          <a class="xref" href="CSJ2K.j2k.codestream.writer.HeaderEncoder.isOrigSig.html">isOrigSig</a>
        </td>
        <td class="markdown level1 summary"><p>An array specifying, for each component,if the data was signed or not</p>
</td>
      </tr>
      <tr>
        <td id="CSJ2K_j2k_codestream_writer_HeaderEncoder_origSrc" data-uid="CSJ2K.j2k.codestream.writer.HeaderEncoder.origSrc">
          <a class="xref" href="CSJ2K.j2k.codestream.writer.HeaderEncoder.origSrc.html">origSrc</a>
        </td>
        <td class="markdown level1 summary"><p>The image data reader. Source of original data info</p>
</td>
      </tr>
      <tr>
        <td id="CSJ2K_j2k_codestream_writer_HeaderEncoder_ralloc" data-uid="CSJ2K.j2k.codestream.writer.HeaderEncoder.ralloc">
          <a class="xref" href="CSJ2K.j2k.codestream.writer.HeaderEncoder.ralloc.html">ralloc</a>
        </td>
        <td class="markdown level1 summary"><p>Reference to the rate allocator</p>
</td>
      </tr>
      <tr>
        <td id="CSJ2K_j2k_codestream_writer_HeaderEncoder_roiSc" data-uid="CSJ2K.j2k.codestream.writer.HeaderEncoder.roiSc">
          <a class="xref" href="CSJ2K.j2k.codestream.writer.HeaderEncoder.roiSc.html">roiSc</a>
        </td>
        <td class="markdown level1 summary"><p>Reference to the ROI module</p>
</td>
      </tr>
      <tr>
        <td id="CSJ2K_j2k_codestream_writer_HeaderEncoder_tiler" data-uid="CSJ2K.j2k.codestream.writer.HeaderEncoder.tiler">
          <a class="xref" href="CSJ2K.j2k.codestream.writer.HeaderEncoder.tiler.html">tiler</a>
        </td>
        <td class="markdown level1 summary"><p>Reference to the tiler module</p>
</td>
      </tr>
    </tbody>
  </table>
  <h3 id="properties">Properties
</h3>
  <table class="table table-bordered table-condensed">
    <thead>
      <tr>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td id="CSJ2K_j2k_codestream_writer_HeaderEncoder_Buffer" data-uid="CSJ2K.j2k.codestream.writer.HeaderEncoder.Buffer">
          <a class="xref" href="CSJ2K.j2k.codestream.writer.HeaderEncoder.Buffer.html#CSJ2K_j2k_codestream_writer_HeaderEncoder_Buffer">Buffer</a>
        </td>
        <td class="markdown level1 summary"><p>Returns the byte-buffer used to store the codestream header.</p>
</td>
      </tr>
      <tr>
        <td id="CSJ2K_j2k_codestream_writer_HeaderEncoder_BufferLength" data-uid="CSJ2K.j2k.codestream.writer.HeaderEncoder.BufferLength">
          <a class="xref" href="CSJ2K.j2k.codestream.writer.HeaderEncoder.BufferLength.html#CSJ2K_j2k_codestream_writer_HeaderEncoder_BufferLength">BufferLength</a>
        </td>
        <td class="markdown level1 summary"><p>Returns the number of bytes used in the codestream header's buffer.</p>
</td>
      </tr>
      <tr>
        <td id="CSJ2K_j2k_codestream_writer_HeaderEncoder_Length" data-uid="CSJ2K.j2k.codestream.writer.HeaderEncoder.Length">
          <a class="xref" href="CSJ2K.j2k.codestream.writer.HeaderEncoder.Length.html#CSJ2K_j2k_codestream_writer_HeaderEncoder_Length">Length</a>
        </td>
        <td class="markdown level1 summary"><p>Returns the length of the header.</p>
</td>
      </tr>
      <tr>
        <td id="CSJ2K_j2k_codestream_writer_HeaderEncoder_ParameterInfo" data-uid="CSJ2K.j2k.codestream.writer.HeaderEncoder.ParameterInfo">
          <a class="xref" href="CSJ2K.j2k.codestream.writer.HeaderEncoder.ParameterInfo.html#CSJ2K_j2k_codestream_writer_HeaderEncoder_ParameterInfo">ParameterInfo</a>
        </td>
        <td class="markdown level1 summary"><p>Returns the parameters that are used in this class and implementing
classes. It returns a 2D String array. Each of the 1D arrays is for a
different option, and they have 3 elements. The first element is the
option name, the second one is the synopsis, the third one is a long
description of what the parameter is and the fourth is its default
value. The synopsis or description may be 'null', in which case it is
assumed that there is no synopsis or description of the option,
respectively. Null may be returned if no options are supported.</p>
</td>
      </tr>
    </tbody>
  </table>
  <h3 id="methods">Methods
</h3>
  <table class="table table-bordered table-condensed">
    <thead>
      <tr>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td id="CSJ2K_j2k_codestream_writer_HeaderEncoder_encodeMainHeader" data-uid="CSJ2K.j2k.codestream.writer.HeaderEncoder.encodeMainHeader">
          <a class="xref" href="CSJ2K.j2k.codestream.writer.HeaderEncoder.encodeMainHeader.html#CSJ2K_j2k_codestream_writer_HeaderEncoder_encodeMainHeader">encodeMainHeader()</a>
        </td>
        <td class="markdown level1 summary"><p>Write main header. JJ2000 main header corresponds to the following
sequence of marker segments:</p>
<pre><code>       &lt;ol&gt;&lt;li&gt;SOC&lt;/li&gt;&lt;li&gt;SIZ&lt;/li&gt;&lt;li&gt;COD&lt;/li&gt;&lt;li&gt;COC (if needed)&lt;/li&gt;&lt;li&gt;QCD&lt;/li&gt;&lt;li&gt;QCC (if needed)&lt;/li&gt;&lt;li&gt;POC (if needed)&lt;/li&gt;&lt;/ol&gt;
</code></pre>
</td>
      </tr>
      <tr>
        <td id="CSJ2K_j2k_codestream_writer_HeaderEncoder_encodeTilePartHeader_System_Int32_System_Int32_" data-uid="CSJ2K.j2k.codestream.writer.HeaderEncoder.encodeTilePartHeader(System.Int32,System.Int32)">
          <a class="xref" href="CSJ2K.j2k.codestream.writer.HeaderEncoder.encodeTilePartHeader.html#CSJ2K_j2k_codestream_writer_HeaderEncoder_encodeTilePartHeader_System_Int32_System_Int32_">encodeTilePartHeader(int, int)</a>
        </td>
        <td class="markdown level1 summary"><p>Writes tile-part header. JJ2000 tile-part header corresponds to the
following sequence of marker segments:</p>
<pre><code>       &lt;ol&gt;&lt;li&gt;SOT&lt;/li&gt;&lt;li&gt;COD (if needed)&lt;/li&gt;&lt;li&gt;COC (if needed)&lt;/li&gt;&lt;li&gt;QCD (if needed)&lt;/li&gt;&lt;li&gt;QCC (if needed)&lt;/li&gt;&lt;li&gt;RGN (if needed)&lt;/li&gt;&lt;li&gt;POC (if needed)&lt;/li&gt;&lt;li&gt;SOD&lt;/li&gt;&lt;/ol&gt;
</code></pre>
</td>
      </tr>
      <tr>
        <td id="CSJ2K_j2k_codestream_writer_HeaderEncoder_reset" data-uid="CSJ2K.j2k.codestream.writer.HeaderEncoder.reset">
          <a class="xref" href="CSJ2K.j2k.codestream.writer.HeaderEncoder.reset.html#CSJ2K_j2k_codestream_writer_HeaderEncoder_reset">reset()</a>
        </td>
        <td class="markdown level1 summary"><p>Resets the contents of this HeaderEncoder to its initial state. It
erases all the data in the header buffer and reactualizes the
headerLength field of the bit stream writer.</p>
</td>
      </tr>
      <tr>
        <td id="CSJ2K_j2k_codestream_writer_HeaderEncoder_writeCOC_System_Boolean_System_Int32_System_Int32_" data-uid="CSJ2K.j2k.codestream.writer.HeaderEncoder.writeCOC(System.Boolean,System.Int32,System.Int32)">
          <a class="xref" href="CSJ2K.j2k.codestream.writer.HeaderEncoder.writeCOC.html#CSJ2K_j2k_codestream_writer_HeaderEncoder_writeCOC_System_Boolean_System_Int32_System_Int32_">writeCOC(bool, int, int)</a>
        </td>
        <td class="markdown level1 summary"><p>Writes COC marker segment . It is a functional marker containing the
coding style for one component (coding style, decomposition, layering).</p>
<pre><code>       &lt;p&gt;Its values overrides any value previously set in COD in the main
       header or in the tile header.&lt;/p&gt;
</code></pre>
</td>
      </tr>
      <tr>
        <td id="CSJ2K_j2k_codestream_writer_HeaderEncoder_writeCOD_System_Boolean_System_Int32_" data-uid="CSJ2K.j2k.codestream.writer.HeaderEncoder.writeCOD(System.Boolean,System.Int32)">
          <a class="xref" href="CSJ2K.j2k.codestream.writer.HeaderEncoder.writeCOD.html#CSJ2K_j2k_codestream_writer_HeaderEncoder_writeCOD_System_Boolean_System_Int32_">writeCOD(bool, int)</a>
        </td>
        <td class="markdown level1 summary"><p>Writes COD marker segment. COD is a functional marker segment
containing the code style default (coding style, decomposition,
layering) used for compressing all the components in an image.</p>
<pre><code>       &lt;p&gt;The values can be overriden for an individual component by a COC
       marker in either the main or the tile header.&lt;/p&gt;
</code></pre>
</td>
      </tr>
      <tr>
        <td id="CSJ2K_j2k_codestream_writer_HeaderEncoder_writeMainQCC_System_Int32_" data-uid="CSJ2K.j2k.codestream.writer.HeaderEncoder.writeMainQCC(System.Int32)">
          <a class="xref" href="CSJ2K.j2k.codestream.writer.HeaderEncoder.writeMainQCC.html#CSJ2K_j2k_codestream_writer_HeaderEncoder_writeMainQCC_System_Int32_">writeMainQCC(int)</a>
        </td>
        <td class="markdown level1 summary"><p>Writes QCC marker segment in main header. It is a functional marker
segment countaining the quantization used for compressing the specified
component in an image. The values override for the specified component
what was defined by a QCC marker in either the main or the tile header.</p>
</td>
      </tr>
      <tr>
        <td id="CSJ2K_j2k_codestream_writer_HeaderEncoder_writeMainQCD" data-uid="CSJ2K.j2k.codestream.writer.HeaderEncoder.writeMainQCD">
          <a class="xref" href="CSJ2K.j2k.codestream.writer.HeaderEncoder.writeMainQCD.html#CSJ2K_j2k_codestream_writer_HeaderEncoder_writeMainQCD">writeMainQCD()</a>
        </td>
        <td class="markdown level1 summary"><p>Writes QCD marker segment in main header. QCD is a functional marker
segment countaining the quantization default used for compressing all
the components in an image. The values can be overriden for an
individual component by a QCC marker in either the main or the tile
header.</p>
</td>
      </tr>
      <tr>
        <td id="CSJ2K_j2k_codestream_writer_HeaderEncoder_writePOC_System_Boolean_System_Int32_" data-uid="CSJ2K.j2k.codestream.writer.HeaderEncoder.writePOC(System.Boolean,System.Int32)">
          <a class="xref" href="CSJ2K.j2k.codestream.writer.HeaderEncoder.writePOC.html#CSJ2K_j2k_codestream_writer_HeaderEncoder_writePOC_System_Boolean_System_Int32_">writePOC(bool, int)</a>
        </td>
        <td class="markdown level1 summary"><p>Writes POC marker segment. POC is a functional marker segment
containing the bounds and progression order for any progression order
other than default in the codestream.</p>
</td>
      </tr>
      <tr>
        <td id="CSJ2K_j2k_codestream_writer_HeaderEncoder_writeTileQCC_System_Int32_System_Int32_" data-uid="CSJ2K.j2k.codestream.writer.HeaderEncoder.writeTileQCC(System.Int32,System.Int32)">
          <a class="xref" href="CSJ2K.j2k.codestream.writer.HeaderEncoder.writeTileQCC.html#CSJ2K_j2k_codestream_writer_HeaderEncoder_writeTileQCC_System_Int32_System_Int32_">writeTileQCC(int, int)</a>
        </td>
        <td class="markdown level1 summary"><p>Writes QCC marker segment in tile header. It is a functional marker
segment countaining the quantization used for compressing the specified
component in an image. The values override for the specified component
what was defined by a QCC marker in either the main or the tile header.</p>
</td>
      </tr>
      <tr>
        <td id="CSJ2K_j2k_codestream_writer_HeaderEncoder_writeTileQCD_System_Int32_" data-uid="CSJ2K.j2k.codestream.writer.HeaderEncoder.writeTileQCD(System.Int32)">
          <a class="xref" href="CSJ2K.j2k.codestream.writer.HeaderEncoder.writeTileQCD.html#CSJ2K_j2k_codestream_writer_HeaderEncoder_writeTileQCD_System_Int32_">writeTileQCD(int)</a>
        </td>
        <td class="markdown level1 summary"><p>Writes QCD marker segment in tile header. QCD is a functional marker
segment countaining the quantization default used for compressing all
the components in an image. The values can be overriden for an
individual component by a QCC marker in either the main or the tile
header.</p>
</td>
      </tr>
      <tr>
        <td id="CSJ2K_j2k_codestream_writer_HeaderEncoder_writeTo_CSJ2K_j2k_io_BinaryDataOutput_" data-uid="CSJ2K.j2k.codestream.writer.HeaderEncoder.writeTo(CSJ2K.j2k.io.BinaryDataOutput)">
          <a class="xref" href="CSJ2K.j2k.codestream.writer.HeaderEncoder.writeTo.html#CSJ2K_j2k_codestream_writer_HeaderEncoder_writeTo_CSJ2K_j2k_io_BinaryDataOutput_">writeTo(BinaryDataOutput)</a>
        </td>
        <td class="markdown level1 summary"><p>Writes the header to the specified BinaryDataOutput.</p>
</td>
      </tr>
      <tr>
        <td id="CSJ2K_j2k_codestream_writer_HeaderEncoder_writeTo_System_IO_Stream_" data-uid="CSJ2K.j2k.codestream.writer.HeaderEncoder.writeTo(System.IO.Stream)">
          <a class="xref" href="CSJ2K.j2k.codestream.writer.HeaderEncoder.writeTo.html#CSJ2K_j2k_codestream_writer_HeaderEncoder_writeTo_System_IO_Stream_">writeTo(Stream)</a>
        </td>
        <td class="markdown level1 summary"><p>Writes the header to the specified OutputStream.</p>
</td>
      </tr>
    </tbody>
  </table>
  <h3 id="seealso">See Also</h3>
  <div class="seealso">
      <div><a class="xref" href="CSJ2K.j2k.codestream.Markers.html">Markers</a></div>
      <div><a class="xref" href="CSJ2K.j2k.entropy.encoder.EBCOTRateAllocator.html">EBCOTRateAllocator</a></div>
  </div>

</div>
