comparison Applications/Dicomizer.cpp @ 324:a92bb720f90b

renamed option --tiff-alignment as --padding
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 16 Oct 2024 21:08:58 +0200
parents 429c4efa1fde
children 9947e70cbcea
comparison
equal deleted inserted replaced
323:429c4efa1fde 324:a92bb720f90b
58 static const char* OPTION_COLOR = "color"; 58 static const char* OPTION_COLOR = "color";
59 static const char* OPTION_COMPRESSION = "compression"; 59 static const char* OPTION_COMPRESSION = "compression";
60 static const char* OPTION_DATASET = "dataset"; 60 static const char* OPTION_DATASET = "dataset";
61 static const char* OPTION_FOLDER = "folder"; 61 static const char* OPTION_FOLDER = "folder";
62 static const char* OPTION_FOLDER_PATTERN = "folder-pattern"; 62 static const char* OPTION_FOLDER_PATTERN = "folder-pattern";
63 static const char* OPTION_FORCE_OPENSLIDE = "force-openslide";
64 static const char* OPTION_HELP = "help"; 63 static const char* OPTION_HELP = "help";
65 static const char* OPTION_ICC_PROFILE = "icc-profile"; 64 static const char* OPTION_ICC_PROFILE = "icc-profile";
66 static const char* OPTION_IMAGED_DEPTH = "imaged-depth"; 65 static const char* OPTION_IMAGED_DEPTH = "imaged-depth";
67 static const char* OPTION_IMAGED_HEIGHT = "imaged-height"; 66 static const char* OPTION_IMAGED_HEIGHT = "imaged-height";
68 static const char* OPTION_IMAGED_WIDTH = "imaged-width"; 67 static const char* OPTION_IMAGED_WIDTH = "imaged-width";
93 static const char* OPTION_CYTOMINE_PUBLIC_KEY = "cytomine-public-key"; 92 static const char* OPTION_CYTOMINE_PUBLIC_KEY = "cytomine-public-key";
94 static const char* OPTION_CYTOMINE_PRIVATE_KEY = "cytomine-private-key"; 93 static const char* OPTION_CYTOMINE_PRIVATE_KEY = "cytomine-private-key";
95 static const char* OPTION_CYTOMINE_COMPRESSION = "cytomine-compression"; 94 static const char* OPTION_CYTOMINE_COMPRESSION = "cytomine-compression";
96 95
97 // New in release 2.1 96 // New in release 2.1
98 static const char* OPTION_TIFF_ALIGNMENT = "tiff-alignment"; 97 static const char* OPTION_FORCE_OPENSLIDE = "force-openslide";
98 static const char* OPTION_PADDING = "padding";
99 99
100 100
101 #if ORTHANC_FRAMEWORK_VERSION_IS_ABOVE(1, 9, 0) 101 #if ORTHANC_FRAMEWORK_VERSION_IS_ABOVE(1, 9, 0)
102 102
103 bool ReadJsonWithoutComments(Json::Value& target, 103 bool ReadJsonWithoutComments(Json::Value& target,
579 (OPTION_VERSION, "Output version information and exit") 579 (OPTION_VERSION, "Output version information and exit")
580 (OPTION_VERBOSE, "Be verbose in logs") 580 (OPTION_VERBOSE, "Be verbose in logs")
581 (OPTION_THREADS, 581 (OPTION_THREADS,
582 boost::program_options::value<int>()->default_value(parameters.GetThreadsCount()), 582 boost::program_options::value<int>()->default_value(parameters.GetThreadsCount()),
583 "Number of processing threads to be used") 583 "Number of processing threads to be used")
584 (OPTION_FORCE_OPENSLIDE, boost::program_options::value<bool>(), 584 (OPTION_FORCE_OPENSLIDE, boost::program_options::value<bool>()->default_value(false),
585 "Whether to force the use of OpenSlide on input TIFF-like files (Boolean)") 585 "Whether to force the use of OpenSlide on input TIFF-like files (Boolean)")
586 (OPTION_OPENSLIDE, boost::program_options::value<std::string>(), 586 (OPTION_OPENSLIDE, boost::program_options::value<std::string>(),
587 "Path to the shared library of OpenSlide " 587 "Path to the shared library of OpenSlide "
588 "(not necessary if converting from standard hierarchical TIFF)") 588 "(not necessary if converting from standard hierarchical TIFF)")
589 ; 589 ;
598 "Whether to re-encode each tile (no transcoding, much slower) (Boolean)") 598 "Whether to re-encode each tile (no transcoding, much slower) (Boolean)")
599 (OPTION_REPAINT, boost::program_options::value<bool>(), 599 (OPTION_REPAINT, boost::program_options::value<bool>(),
600 "Whether to repaint the background of the image (Boolean)") 600 "Whether to repaint the background of the image (Boolean)")
601 (OPTION_COLOR, boost::program_options::value<std::string>(), 601 (OPTION_COLOR, boost::program_options::value<std::string>(),
602 "Color of the background (e.g. \"255,0,0\")") 602 "Color of the background (e.g. \"255,0,0\")")
603 (OPTION_TIFF_ALIGNMENT, boost::program_options::value<int>()->default_value(64), 603 (OPTION_PADDING, boost::program_options::value<int>()->default_value(1),
604 "Add padding to plain TIFF images to align the width/height to multiples " 604 "Add padding to plain PNG/JPEG/TIFF images to align the width/height to multiples "
605 "of this value, very useful to enable deep zoom with IIIF (1 means no padding)") 605 "of this value, which enables deep zoom with IIIF (1 means no padding)")
606 ; 606 ;
607 607
608 boost::program_options::options_description cytomine("Options if importing from Cytomine"); 608 boost::program_options::options_description cytomine("Options if importing from Cytomine");
609 cytomine.add_options() 609 cytomine.add_options()
610 (OPTION_CYTOMINE_URL, boost::program_options::value<std::string>(), 610 (OPTION_CYTOMINE_URL, boost::program_options::value<std::string>(),
1019 if (options.count(OPTION_ICC_PROFILE)) 1019 if (options.count(OPTION_ICC_PROFILE))
1020 { 1020 {
1021 parameters.SetIccProfilePath(options[OPTION_ICC_PROFILE].as<std::string>()); 1021 parameters.SetIccProfilePath(options[OPTION_ICC_PROFILE].as<std::string>());
1022 } 1022 }
1023 1023
1024 if (options.count(OPTION_TIFF_ALIGNMENT)) 1024 if (options.count(OPTION_PADDING))
1025 { 1025 {
1026 int value = options[OPTION_TIFF_ALIGNMENT].as<int>(); 1026 int value = options[OPTION_PADDING].as<int>();
1027 if (value <= 0) 1027 if (value <= 0)
1028 { 1028 {
1029 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange, 1029 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange,
1030 "TIFF alignment must be >= 1"); 1030 "Padding must be >= 1");
1031 } 1031 }
1032 else 1032 else
1033 { 1033 {
1034 parameters.SetTiffAlignment(static_cast<unsigned int>(value)); 1034 parameters.SetPadding(static_cast<unsigned int>(value));
1035 } 1035 }
1036 } 1036 }
1037 1037
1038 return true; 1038 return true;
1039 } 1039 }
1105 { 1105 {
1106 sourceCompression = OrthancWSI::ImageCompression_Unknown; 1106 sourceCompression = OrthancWSI::ImageCompression_Unknown;
1107 return new OrthancWSI::PlainTiff(path, 1107 return new OrthancWSI::PlainTiff(path,
1108 parameters.GetTargetTileWidth(512), 1108 parameters.GetTargetTileWidth(512),
1109 parameters.GetTargetTileHeight(512), 1109 parameters.GetTargetTileHeight(512),
1110 parameters.GetTiffAlignment(), 1110 parameters.GetPadding(),
1111 parameters.GetBackgroundColorRed(), 1111 parameters.GetBackgroundColorRed(),
1112 parameters.GetBackgroundColorGreen(), 1112 parameters.GetBackgroundColorGreen(),
1113 parameters.GetBackgroundColorBlue()); 1113 parameters.GetBackgroundColorBlue());
1114 } 1114 }
1115 catch (Orthanc::OrthancException&) 1115 catch (Orthanc::OrthancException&)