{
  /**
   * Advanced configuration options of Orthanc
   *
   * This file gathers advanced options that were part of the main
   * configuration file until Orthanc 1.12.11.
   **/


  /**
   * Generic options
   **/

  // Enable/disable specific warnings in the logs.
  // "true" enables a warning. All warnings are enabled by default
  // see https://orthanc.uclouvain.be/book/faq/main-dicom-tags.html#warnings
  // (new in Orthanc 1.11.0)
  "Warnings" : {
    // A "RequestedTags" has been read from storage which is slower than
    // reading it from DB.
    // You might want to store this tag in ExtraMainDicomTags to build
    // the response faster.
    "W001_TagsBeingReadFromStorage" : true,

    // Retrieving a list of Main dicom tags from a resource that has been
    // saved with another "ExtraMainDicomTags" configuration which means that
    // your response might be incomplete/inconsistent.
    // You should call patients|studies|series|instances/../reconstruct to rebuild
    // the DB.  You may also check for the "Housekeeper" plugin.
    "W002_InconsistentDicomTagsInDb" : true,

    // Display a warning message when Orthanc and its plugins are unable
    // to decode a frame (new in Orthanc 1.12.5).
    "W003_DecoderFailure" : true,

    // Display a warning when the MainDicomTagsSignature metadata has not been
    // found which means that the resource has been saved with a version prior
    // to 1.11.0.
    // You should call patients|studies|series|instances/../reconstruct to rebuild
    // the DB.  You may also check for the "Housekeeper" plugin.
    // (new in Orthanc 1.12.5)
    "W004_NoMainDicomTagsSignature" : true,

    // Display a warning when a user performs a find request and requests a tag
    // from a lower resource level; e.g. when requesting "StudyDescription" at
    // Patient level.
    // (new in Orthanc 1.12.5)
    "W005_RequestingTagFromLowerResourceLevel" : true,

    // Display a warning when a user performs a find request and requests a tag
    // from the DICOM Meta Header.
    // (new in Orthanc 1.12.5)
    "W006_RequestingTagFromMetaHeader" : true,

    // Display a warning when a user requests a tag that can not be read from disk
    // because "StorageAccessOnFind" is set to "Never".
    // (new in Orthanc 1.12.5)
    "W007_MissingRequestedTagsNotReadFromDisk" : true
  },

  // Path to the directory where Orthanc stores its large temporary
  // files. The content of this folder can be safely deleted once
  // Orthanc is stopped. The folder must exist. The corresponding
  // filesystem must be properly sized, given that for instance a ZIP
  // archive of DICOM images created by a job can weight several GBs,
  // and that there might be up to "min(JobsHistorySize,
  // MediaArchiveSize)" archives to be stored simultaneously. If not
  // set, Orthanc will use the default temporary folder of the
  // operating system (such as "/tmp/" on UNIX-like systems, or
  // "C:/Temp" on Microsoft Windows).
  // "TemporaryDirectory" : "/tmp/Orthanc/",

  // Dictionary of symbolic names for the user-defined metadata. Each
  // entry must map an unique string to an unique number between 1024
  // and 65535. Reserved values:
  //  - The Orthanc whole-slide imaging plugin uses metadata 4200
  "UserMetadata" : {
    // "Sample" : 1024
  },

  // Dictionary of symbolic names for the user-defined types of
  // attached files. Each entry must map an unique string to an unique
  // number between 1024 and 65535. Optionally, a second argument can
  // provided to specify a MIME content type for the attachment.
  "UserContentType" : {
    // "sample" : 1024
    // "sample2" : [ 1025, "application/pdf" ]
  },

  // When the following option is "true", the MD5 of the DICOM files
  // will be computed and stored in the Orthanc database. This
  // information can be used to detect disk corruption, at the price
  // of a small performance overhead.
  "StoreMD5ForAttachments" : true,

  // The period (in seconds) between 2 calls of the "OnHeartBeat"
  // lua callback.  O means the heart beat is disabled.
  // Note: that the period is actually not the delay between
  // the end of an execution and the triggering of the next one.
  // Since there is only one lua context, if other lua code is being
  // executed, the heart beat might be delayed even more.
  "LuaHeartBeatPeriod" : 0,

  // If this option is set to "true" (default behavior until Orthanc
  // 1.3.2), Orthanc will log the resources that are exported to other
  // DICOM modalities or Orthanc peers, inside the URI
  // "/exports". Setting this option to "false" is useful to prevent
  // the index to grow indefinitely in auto-routing tasks (this is the
  // default behavior since Orthanc 1.4.0).
  "LogExportedResources" : false,

  // Configure PKCS#11 to use hardware security modules (HSM) and
  // smart cards when carrying on HTTPS client authentication.
  /**
     "Pkcs11" : {
       "Module" : "/usr/local/lib/libbeidpkcs11.so",
       "Module" : "C:/Windows/System32/beidpkcs11.dll",
       "Pin" : "1234",
       "Verbose" : true
     }
   **/

  // Whether calls to URI "/tools/execute-script" is enabled. Starting
  // with Orthanc 1.5.8, this URI is disabled by default for security.
  "ExecuteLuaEnabled" : false,

  // Whether the REST API can write to the filesystem (e.g. in
  // /instances/../export route). Starting with Orthanc 1.12.0,
  // this URI is disabled by default for security.
  "RestApiWriteToFileSystemEnabled" : false,

  // When set to "false", this option disables all "/patients" routes
  // and disables patient-level sanity checks when performing resource
  // modification. This is notably useful if your Orthanc stores DICOM
  // resources from multiple sources, in which the same PatientID
  // might be assigned to different patients because there is no
  // centralized patient ID management. (new in Orthanc 1.12.11)
  // Warning: As of 1.12.11, this is an experimental configuration.
  "PatientLevelEnabled" : true,


  /**
   * Configuration of the HTTP server
   **/

  // When the following option is "true", if an error is encountered
  // while calling the REST API, a JSON message describing the error
  // is put in the HTTP answer. This feature can be disabled if the
  // HTTP client does not properly handles such answers.
  "HttpDescribeErrors" : true,

  // Enable HTTP compression to improve network bandwidth utilization,
  // at the expense of more computations on the server. Orthanc
  // supports the "gzip" and "deflate" HTTP encodings.
  // When working on a LAN or on localhost, you should typically set
  // this configuration to false while when working on low-bandwidth,
  // you should set it to true.
  // Note in versions up to 1.12.1, the default value was "true" and is
  // "false" since 1.12.2.
  "HttpCompressionEnabled" : false,

  // Enable or disable HTTP Keep-Alive (persistent HTTP
  // connections). Setting this option to "true" prevents Orthanc
  // issue #32 ("HttpServer does not support multiple HTTP requests in
  // the same TCP stream"), but can possibly slow down HTTP clients
  // that do not support persistent connections. The default behavior
  // used to be "false" in Orthanc <= 1.5.1. Setting this option to
  // "false" is also recommended if Orthanc is compiled against
  // Mongoose.
  "KeepAlive" : true,

  // Defines the Keep-Alive timeout in seconds.
  // (new in Orthanc 1.11.3)
  "KeepAliveTimeout" : 1,

  // Enable or disable Nagle's algorithm. Only taken into
  // consideration if Orthanc is compiled to use CivetWeb. Experiments
  // show that best performance can be obtained by setting both
  // "KeepAlive" and "TcpNoDelay" to "true". Beware however of
  // caveats: https://eklitzke.org/the-caveats-of-tcp-nodelay
  "TcpNoDelay" : true,

  // Set the timeout while serving HTTP requests by the embedded Web
  // server, in seconds. This corresponds to option
  // "request_timeout_ms" of Mongoose/Civetweb. It will set the socket
  // options "SO_RCVTIMEO" and "SO_SNDTIMEO" to the specified value.
  "HttpRequestTimeout" : 30,

  // Maximum allowed size (in MB) of the body of an HTTP request (POST
  // or PUT), to prevent resource exhaustion. A value of "0" means no
  // limit (default in Orthanc <= 1.12.10). (new in Orthanc 1.12.11)
  "MaximumRequestBodySizeMB" : 8192,

  // Maximum allowed size (in MB) of a single file after decompression
  // when it is contained in a ZIP or gzip archive, to prevent resource
  // exhaustion by ZIP/gzip bombs. A value of "0" means no limit (this
  // was the default in Orthanc <= 1.12.10). (new in Orthanc 1.12.11)
  "MaximumFileSizeInArchiveMB" : 4096,


  /**
   * Configuration of the DICOM connections (SCU/SCP)
   **/

  // Set the timeout (in seconds) after which the DICOM associations
  // are closed by the Orthanc SCP (server) if no further DIMSE
  // command is received from the SCU (client).
  // A value of 0 means "no timeout".
  "DicomScpTimeout" : 30,

  // The timeout (in seconds) after which the DICOM associations are
  // considered as closed by the Orthanc SCU (client) if the remote
  // DICOM SCP (server) does not answer.
  // A value of 0 means "no timeout".
  "DicomScuTimeout" : 10,

  // DICOM associations initiated by Lua scripts are kept open as long
  // as new DICOM commands are issued. This option sets the number of
  // seconds of inactivity to wait before automatically closing a
  // DICOM association used by Lua. If set to 0, the connection is
  // closed immediately. This option is only used in Lua scripts.
  "DicomAssociationCloseDelay" : 5,

  // Maximum length of the PDU (Protocol Data Unit) in the DICOM
  // network protocol, expressed in bytes. This value affects both
  // Orthanc SCU and Orthanc SCP. It defaults to 16KB. The allowed
  // range is [4096,131072]. (new in Orthanc 1.9.0)
  "MaximumPduLength" : 16384,


  /**
   * Security-related options for the HTTP server
   **/

  // Sets the minimum accepted SSL protocol version for the HTTP server
  // (cf. "ssl_protocol_version" option of civetweb). By default,
  // require TLS 1.2 or 1.3. This option is only meaningful if "SslEnabled"
  // is true. (new in Orthanc 1.8.2)
  //
  // Value => Protocols
  //   0      SSL2+SSL3+TLS1.0+TLS1.1+TLS1.2+TLS1.3
  //   1      SSL3+TLS1.0+TLS1.1+TLS1.2+TLS1.3
  //   2      TLS1.0+TLS1.1+TLS1.2+TLS1.3
  //   3      TLS1.1+TLS1.2+TLS1.3
  //   4      TLS1.2+TLS1.3
  //   5      TLS1.3
  "SslMinimumProtocolVersion" : 4,

  // Set the accepted ciphers for SSL connections for the HTTP server.
  // The ciphers must be provided as a list of strings. If not set,
  // this will default to FIPS 140-2 ciphers. This option is only
  // meaningful if "SslEnabled" is true. (new in Orthanc 1.8.2)
  /**
    "SslCiphersAccepted" : [ "AES128-GCM-SHA256" ],
  **/


  /**
   * Security-related options for the DICOM connections (SCU/SCP)
   **/

  // Set the minimum accepted TLS protocol version for the DICOM server
  // By default, require TLS 1.2 or 1.3. This option is only meaningful
  // if "DicomTlsEnabled" is true (new in Orthanc 1.12.4).
  // Note that, internally, Orthanc is configured to use the BCP195 profile
  // by default.  As soon as you switch to another protocol version, you
  // must also provide the list of supported cipher suites.
  // This configuration applies to Orthanc acting both as SCU and SCP.
  // Value => Protocols
  //   0      use default BCP 195 profile and default cipher suites
  //   1      SSL3+TLS1.0+TLS1.1+TLS1.2+TLS1.3
  //   2      TLS1.0+TLS1.1+TLS1.2+TLS1.3
  //   3      TLS1.1+TLS1.2+TLS1.3
  //   4      TLS1.2+TLS1.3
  //   5      TLS1.3
  "DicomTlsMinimumProtocolVersion" : 0,

  // Set the accepted ciphers for TLS connections for the DICOM server.
  // The ciphers must be provided as a list of strings. If not set,
  // this will default to BCP195 ciphers if DicomTlsMinimumProtocolVersion is 0
  // or to an empty list for other values. This option is only
  // meaningful if "DicomTlsEnabled" is true. (new in Orthanc 1.12.4).
  // This configuration must be provided if DicomTlsMinimumProtocolVersion != 0.
  // The list of valid cipher names are available in
  // https://www.openssl.org/docs/man3.3/man1/openssl-ciphers.html
  // The OpenSSL names are used.
  /**
     "DicomTlsCiphersAccepted" : [],
  **/


  /**
   * Performance-related options
   **/

  // Defines the number of threads that are used to execute each type of
  // jobs (for the jobs that can be parallelized).
  // A value of "0" indicates to use all the available CPU logical cores.
  // (new in Orthanc 1.11.3)
  "JobsEngineThreadsCount" : {
    "ResourceModification" : 1     // for /anonymize, /modify
  },

  // Whether "fsync()" is called after each write to the storage area
  // (new in Orthanc 1.7.4). If this option is set to "true", Orthanc
  // will run more slowly, but the DICOM are guaranteed to be
  // immediately written to the disk. This option only makes sense if
  // the builtin filesystem storage area is used or the advanced
  // storage plugin. It defaults to "false" in Orthanc <= 1.7.3,
  // and to "true" in Orthanc >= 1.7.4.
  "SyncStorageArea" : true,

  // If specified, on compatible systems, call "mallopt(M_ARENA_MAX,
  // ...)" while starting Orthanc. This has the same effect at setting
  // the environment variable "MALLOC_ARENA_MAX". This avoids large
  // growth in RES memory if the threads of the embedded HTTP server
  // have to allocate large chunks of memory (typically the case with
  // large DICOM files). By setting "MallocArenaMax" to "N", these
  // threads share "N" memory pools (known as "arenas"). Setting this
  // option to "0" doesn't call mallopt()", which was the behavior of
  // Orthanc <= 1.8.1.
  "MallocArenaMax" : 5,

  // Maximum number of DCMTK transcoders that are simultaneously running
  // at any given time. A value of "0" indicates to use all the
  // available CPU logical cores. Prior to Orthanc 1.12.6, there was no limit.
  // (new in Orthanc 1.12.6)
  "MaximumConcurrentDcmtkTranscoders" : 0,

  // Number of threads that are used to parse DICOM files (e.g., to
  // access the value of DICOM tags that are not indexed in the
  // Orthanc database). You should monitor the
  // "orthanc_dicom_parser_available_threads" metrics to determine the
  // optimal value for your setup. (new in Orthanc 1.13.0)
  "DicomParserThreadsCount" : 2,

  // Peak amount of RAM (in MB) that can be allocated by the threads
  // that parse the DICOM files. Note that this limit can be exceeded
  // when a single DICOM instance is larger than this option. You
  // should monitor the "orthanc_dicom_parser_memory_usage_mb" and
  // "orthanc_dicom_parser_memory_max_usage_mb" metrics to determine
  // the optimal value for your setup. (new in Orthanc 1.13.0)
  "DicomParserMemoryCapacity" : 256,

  // Maximum size of the cache of parsed DICOM files (in MB). This
  // cache is stored in RAM and contains a parsed version of recently
  // read DICOM files. A value of "0" disables this cache. (new in
  // Orthanc 1.13.0 - in prior versions, this value was hardcoded to 128MB)
  "DicomParserCacheSize" : 256,

  // Number of threads that are used to transcode DICOM files. You
  // should monitor the "orthanc_transcoder_available_threads" metrics
  // to determine the optimal value for your setup. (new in Orthanc 1.13.0)
  "TranscoderThreadsCount" : 4,

  // Peak amount of RAM (in MB) that can be allocated by the threads
  // that transcode DICOM instances. Note that this limit can be
  // exceeded when a single transcoded instance is larger than this
  // option. You should monitor the "orthanc_transcoder_memory_usage_mb"
  // and "orthanc_transcoder_memory_max_usage_mb" metrics to determine
  // the optimal value for your setup. (new in Orthanc 1.13.0)
  "TranscoderMemoryCapacity" : 256,

  // Maximum size of the cache of transcoded DICOM files (in MB). This
  // cache is stored in RAM and contains transcoded versions of
  // recently read DICOM files. A value of "0" disables this
  // cache. (new in Orthanc 1.13.0)
  "TranscoderCacheSize" : 256,

  // Number of threads for the sequential access to DICOM
  // instances. When a thread in Orthanc needs a set of DICOM
  // instances in a predefined order, it cannot rely directly on
  // loader threads, which may provide the instances out of
  // order. This is notably the case for archive jobs, C-STORE SCU
  // connections, and C-GET SCP and C-MOVE SCP handlers. In such
  // situations, Orthanc uses a sliding-window buffer that is
  // populated by a set of threads calling the out-of-order loader
  // threads. These preloading threads are part of a pool that is
  // global to Orthanc. The threads are paused if the buffer grows too
  // large before the calling thread consumes the instances. By
  // default, this option has the same value as
  // "StorageLoaderThreadsCount". You should monitor the
  // "orthanc_sequential_reader_available_threads" metrics to determine the
  // optimal value for your setup and usage. (new in Orthanc 1.13.0)
  // "SequentialDicomReaderThreadsCount" : 4,

  // Each thread that accesses DICOM instances in sequential order
  // creates a local sliding-window buffer that is preloaded by the
  // global thread pool (cf. "SequentialDicomReaderThreadsCount").
  // This configuration option specifies the maximum number of DICOM
  // instances that can be preloaded before they are consumed by the
  // calling thread. Together with
  // "SequentialDicomReaderWindowCapacity", this option determines the
  // amount of memory used by each calling thread that requires
  // sequential access to DICOM instances. This is roughly equivalent
  // to the older "LoaderThreads" configuration: By default, this
  // option is therefore set to the same value as "LoaderThreads", if
  // the latter is available. (new in Orthanc 1.13.0)
  "SequentialDicomReaderWindowSize" : 4,

  // Maximum amount of RAM (in MB) allocated to each local
  // sliding-window buffer for each thread accessing a set of DICOM
  // instances in sequential order (see
  // "SequentialDicomReaderThreadsCount"). The global thread pool
  // pauses preloading as soon as either the
  // "SequentialDicomReaderWindowSize" or
  // "SequentialDicomReaderWindowCapacity" limit is reached. Note that
  // this limit can be exceeded when a single file is larger than the
  // value specified by this option. (new in Orthanc 1.13.0)
  "SequentialDicomReaderWindowCapacity" : 128
}
