Mercurial > hg > orthanc-wsi
changeset 410:6e838900498a
added option --encoding
| author | Sebastien Jodogne <s.jodogne@gmail.com> |
|---|---|
| date | Thu, 06 Nov 2025 15:18:40 +0100 |
| parents | f4483be2364e |
| children | db6e17881cd1 |
| files | Applications/Dicomizer.cpp Framework/DicomizerParameters.cpp Framework/DicomizerParameters.h NEWS |
| diffstat | 4 files changed, 37 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/Applications/Dicomizer.cpp Wed Nov 05 20:44:55 2025 +0100 +++ b/Applications/Dicomizer.cpp Thu Nov 06 15:18:40 2025 +0100 @@ -100,6 +100,9 @@ static const char* OPTION_FORCE_OPENSLIDE = "force-openslide"; static const char* OPTION_PADDING = "padding"; +// New in release 3.3 +static const char* OPTION_ENCODING = "encoding"; + #if ORTHANC_FRAMEWORK_VERSION_IS_ABOVE(1, 9, 0) @@ -332,7 +335,8 @@ -static DcmDataset* ParseDataset(const std::string& path) +static DcmDataset* ParseDataset(const std::string& path, + Orthanc::Encoding encoding) { Json::Value json; @@ -352,7 +356,7 @@ } } - std::unique_ptr<DcmDataset> dataset(Orthanc::FromDcmtkBridge::FromJson(json, true, true, Orthanc::Encoding_Latin1, + std::unique_ptr<DcmDataset> dataset(Orthanc::FromDcmtkBridge::FromJson(json, true, true, encoding, "" /* no private tag, thus no private creator */)); if (dataset.get() == NULL) { @@ -777,6 +781,12 @@ (OPTION_FOLDER_PATTERN, boost::program_options::value<std::string>()->default_value("wsi-%06d.dcm"), "Pattern for the files in the output folder") + (OPTION_ENCODING, boost::program_options::value<std::string>()->default_value("Latin1"), + "The specific character set that will be used in the generated DICOM instances. " + "The allowed values are: \"Ascii\", \"Utf8\", \"Latin1\", \"Latin2\", \"Latin3\", \"Latin4\", " + "\"Latin5\", \"Cyrillic\", \"Windows1251\", \"Arabic\", \"Greek\", \"Hebrew\", " + "\"Thai\", \"Japanese\", \"Chinese\", \"Korean\", \"JapaneseKanji\", and \"SimplifiedChinese\"." + ) ("orthanc", boost::program_options::value<std::string>()->default_value("http://localhost:8042/"), "URL to the REST API of the target Orthanc server") ; @@ -1040,7 +1050,7 @@ if (options.count(OPTION_COMPRESSION)) { - std::string s = options[OPTION_COMPRESSION].as<std::string>(); + const std::string s = options[OPTION_COMPRESSION].as<std::string>(); if (s == "none") { parameters.SetTargetCompression(OrthancWSI::ImageCompression_None); @@ -1133,7 +1143,7 @@ if (options.count(OPTION_OPTICAL_PATH)) { - std::string s = options[OPTION_OPTICAL_PATH].as<std::string>(); + const std::string s = options[OPTION_OPTICAL_PATH].as<std::string>(); if (s == "none") { parameters.SetOpticalPath(OrthancWSI::OpticalPath_None); @@ -1168,6 +1178,12 @@ } } + if (options.count(OPTION_ENCODING)) + { + const std::string s = options[OPTION_ENCODING].as<std::string>(); + parameters.SetEncoding(Orthanc::StringToEncoding(s.c_str())); + } + return true; } @@ -1393,7 +1409,7 @@ LOG(WARNING) << "Compression of the individual source tiles: " << OrthancWSI::EnumerationToString(sourceCompression); // Create the shared DICOM tags - std::unique_ptr<DcmDataset> dataset(ParseDataset(parameters.GetDatasetPath())); + std::unique_ptr<DcmDataset> dataset(ParseDataset(parameters.GetDatasetPath(), parameters.GetEncoding())); EnrichDataset(*dataset, *source, sourceCompression, parameters, volume); std::unique_ptr<OrthancWSI::IFileTarget> output(parameters.CreateTarget());
--- a/Framework/DicomizerParameters.cpp Wed Nov 05 20:44:55 2025 +0100 +++ b/Framework/DicomizerParameters.cpp Thu Nov 06 15:18:40 2025 +0100 @@ -76,7 +76,8 @@ cytomineImageInstanceId_(-1), cytomineCompression_(ImageCompression_Png), forceOpenSlide_(false), - padding_(1) + padding_(1), + encoding_(Orthanc::Encoding_Latin1) { backgroundColor_[0] = 255; backgroundColor_[1] = 255;
--- a/Framework/DicomizerParameters.h Wed Nov 05 20:44:55 2025 +0100 +++ b/Framework/DicomizerParameters.h Thu Nov 06 15:18:40 2025 +0100 @@ -72,6 +72,9 @@ bool forceOpenSlide_; unsigned int padding_; + // New in release 3.3 + Orthanc::Encoding encoding_; + public: DicomizerParameters(); @@ -300,5 +303,15 @@ { return forceOpenSlide_; } + + Orthanc::Encoding GetEncoding() const + { + return encoding_; + } + + void SetEncoding(Orthanc::Encoding encoding) + { + encoding_ = encoding; + } }; }
--- a/NEWS Wed Nov 05 20:44:55 2025 +0100 +++ b/NEWS Thu Nov 06 15:18:40 2025 +0100 @@ -2,6 +2,7 @@ =============================== * OrthancWSIDicomizer: + - New option "--encoding" to specify the specific character set of DICOM instances - Placeholder tags are now automatically inserted when the "--dataset" option provides incomplete data, ensuring the generated DICOM instances remain valid - The version of the DICOM-izer is available in DICOM tag "SoftwareVersions"
