Help with cleaning up DICOM folder structure

I have this installed and I have no trouble getting images in or changing where the images are stored.

Is there anyway to change how it stores the images such that it creates a single folder for each exam?

I found the WritetoDisk.lua but it does not seem to work for me. What am I doing wrong?


  • General configuration of Orthanc

// The logical name of this instance of Orthanc. This one is
// displayed in Orthanc Explorer and at the URI “/system”.
“Name” : “MyOrthanc”,

// Path to the directory that holds the heavyweight files (i.e. the
// raw DICOM instances). Backslashes must be either escaped by
// doubling them, or replaced by forward slashes “/”.
“StorageDirectory” : “F:\LAI”,

// Path to the directory that holds the SQLite index (if unset, the
// value of StorageDirectory is used). This index could be stored on
// a RAM-drive or a SSD device for performance reasons.
“IndexDirectory” : “C:\Orthanc”,

// Path to the directory where Orthanc stores its large temporary
// files. The content of this folder can be safely deleted if
// Orthanc once 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/”,

// Enable the transparent compression of the DICOM instances
“StorageCompression” : false,

// Maximum size of the storage in MB (a value of “0” indicates no
// limit on the storage size)
“MaximumStorageSize” : 0,

// Maximum number of patients that can be stored at a given time
// in the storage (a value of “0” indicates no limit on the number
// of patients)
“MaximumPatientCount” : 0,

// List of paths to the custom Lua scripts that are to be loaded
// into this instance of Orthanc
“LuaScripts” : [ “C:\Orthanc\WriteToDisk.lua”

// List of paths to the plugins that are to be loaded into this
// instance of Orthanc (e.g. “./” for Linux, or
// “./PluginTest.dll” for Windows). These paths can refer to
// folders, in which case they will be scanned non-recursively to
// find shared libraries. Backslashes must be either escaped by
// doubling them, or replaced by forward slashes “/”.
“Plugins” : [ “…/Plugins/” ],

// Maximum number of processing jobs that are simultaneously running
// at any given time. A value of “0” indicates to use all the
// available CPU logical cores. To emulate Orthanc <= 1.3.2, set
// this value to “1”.
“ConcurrentJobs” : 2,


  • Configuration of the HTTP server

// Enable the HTTP server. If this parameter is set to “false”,
// Orthanc acts as a pure DICOM server. The REST API and Orthanc
// Explorer will not be available.
“HttpServerEnabled” : true,

// HTTP port for the REST services and for the GUI
“HttpPort” : 8042,

// 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.
“HttpCompressionEnabled” : true,


  • Configuration of the DICOM server

// Enable the DICOM server. If this parameter is set to “false”,
// Orthanc acts as a pure REST server. It will not be possible to
// receive files or to do query/retrieve through the DICOM protocol.
“DicomServerEnabled” : true,

// The DICOM Application Entity Title (cannot be longer than 16
// characters)
“DicomAet” : “ORTHANC”,

// Check whether the called AET corresponds to the AET of Orthanc
// during an incoming DICOM SCU request
“DicomCheckCalledAet” : false,

// The DICOM port
“DicomPort” : 4242,

// The default encoding that is assumed for DICOM files without
// “SpecificCharacterSet” DICOM tag, and that is used when answering
// C-Find requests (including worklists). The allowed values are
// “Ascii”, “Utf8”, “Latin1”, “Latin2”, “Latin3”, “Latin4”,
// “Latin5”, “Cyrillic”, “Windows1251”, “Arabic”, “Greek”, “Hebrew”,
// “Thai”, “Japanese”, “Chinese”, “JapaneseKanji”, “Korean”, and
// “SimplifiedChinese”.
“DefaultEncoding” : “Latin1”,

// The transfer syntaxes that are accepted by Orthanc C-Store SCP
“DeflatedTransferSyntaxAccepted” : true,
“JpegTransferSyntaxAccepted” : true,
“Jpeg2000TransferSyntaxAccepted” : true,
“JpegLosslessTransferSyntaxAccepted” : true,
“JpipTransferSyntaxAccepted” : true,
“Mpeg2TransferSyntaxAccepted” : true,
“RleTransferSyntaxAccepted” : true,
“Mpeg4TransferSyntaxAccepted” : true, // New in Orthanc 1.6.0

// Whether Orthanc accepts to act as C-Store SCP for unknown storage
// SOP classes (aka. “promiscuous mode”)
“UnknownSopClassAccepted” : false,

// 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).
“DicomScpTimeout” : 30,


  • Security-related options for the HTTP server

// Whether remote hosts can connect to the HTTP server
“RemoteAccessAllowed” : false,

// Whether or not SSL is enabled
“SslEnabled” : false,

// Path to the SSL certificate in the PEM format (meaningful only if
// SSL is enabled)
“SslCertificate” : “certificate.pem”,

// Whether or not the password protection is enabled (using HTTP
// basic access authentication). Starting with Orthanc 1.5.8, if
// “AuthenticationEnabled” is not explicitly set, authentication is
// enabled iff. remote access is allowed (i.e. the default value of
// “AuthenticationEnabled” equals that of “RemoteAccessAllowed”).
“AuthenticationEnabled” : false,

// The list of the registered users. Because Orthanc uses HTTP
// Basic Authentication, the passwords are stored as plain text.
“RegisteredUsers” : {
// “alice” : “alicePassword”


  • Network topology

// The list of the known DICOM modalities
“DicomModalities” : {

  • Uncommenting the following line would enable Orthanc to
  • connect to an instance of the “storescp” open-source DICOM
  • store (shipped in the DCMTK distribution), as started by the
  • command line “storescp 2000”. The first parameter is the
  • AET of the remote modality (cannot be longer than 16
  • characters), the second one is the remote network address,
  • and the third one is the TCP port number corresponding
  • to the DICOM protocol on the remote modality (usually 104).
    // “sample” : [ “STORESCP”, “”, 2000 ]


  • A fourth parameter is available to enable patches for
  • specific PACS manufacturers. The allowed values are currently:
    • “Generic” (default value),
    • “GenericNoWildcardInDates” (to replace “*” by “” in date fields
  • in outgoing C-Find requests originating from Orthanc),
    • “GenericNoUniversalWildcard” (to replace “*” by “” in all fields
  • in outgoing C-Find SCU requests originating from Orthanc),
    • “StoreScp” (storescp tool from DCMTK),
    • “Vitrea”,
    • “GE” (Enterprise Archive, MRI consoles and Advantage Workstation
  • from GE Healthcare).

As always, check out the content of the Orthanc logs in “–verbose” mode: