diff Applications/DicomToTiff.cpp @ 217:20bc074ec19a

Viewer can display DICOM pyramids whose tile sizes vary across levels
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 12 Jan 2021 14:24:18 +0100
parents 1e864138f0da
children 49f647ed1b4c
line wrap: on
line diff
--- a/Applications/DicomToTiff.cpp	Tue Jan 12 10:21:36 2021 +0100
+++ b/Applications/DicomToTiff.cpp	Tue Jan 12 14:24:18 2021 +0100
@@ -199,11 +199,12 @@
     targetPhotometric = source.GetPhotometricInterpretation();
   }
 
+  OrthancWSI::ImageToolbox::CheckConstantTileSize(source); // (**)
   OrthancWSI::HierarchicalTiffWriter target(options[OPTION_OUTPUT].as<std::string>(),
                                             source.GetPixelFormat(), 
                                             OrthancWSI::ImageCompression_Jpeg,  // (*)
-                                            source.GetTileWidth(), 
-                                            source.GetTileHeight(),
+                                            source.GetTileWidth(0),   // (**) 
+                                            source.GetTileHeight(0),  // (**)
                                             targetPhotometric);
 
   if (options.count(OPTION_JPEG_QUALITY))
@@ -229,10 +230,10 @@
                  << " level " << level;
 
     unsigned int countX = OrthancWSI::CeilingDivision
-      (source.GetLevelWidth(level), source.GetTileWidth());
+      (source.GetLevelWidth(level), source.GetTileWidth(level));
 
     unsigned int countY = OrthancWSI::CeilingDivision
-      (source.GetLevelHeight(level), source.GetTileHeight());
+      (source.GetLevelHeight(level), source.GetTileHeight(level));
 
     for (unsigned int tileY = 0; tileY < countY; tileY++)
     {
@@ -259,8 +260,9 @@
 
             if (compression == OrthancWSI::ImageCompression_None)
             {
-              decoded.reset(OrthancWSI::ImageToolbox::DecodeRawTile(tile, source.GetPixelFormat(),
-                                                                    source.GetTileWidth(), source.GetTileHeight()));
+              decoded.reset(OrthancWSI::ImageToolbox::DecodeRawTile(
+                              tile, source.GetPixelFormat(),
+                              source.GetTileWidth(level), source.GetTileHeight(level)));
             }
             else
             {