Mercurial > hg > orthanc-wsi
diff Framework/Algorithms/PyramidReader.cpp @ 318:8ad12abde290
sparse re-encoding with OpenSlide (notably for MIRAX format)
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 11 Sep 2024 16:11:16 +0200 |
parents | 0683312e21ba |
children |
line wrap: on
line diff
--- a/Framework/Algorithms/PyramidReader.cpp Wed Sep 11 13:43:39 2024 +0200 +++ b/Framework/Algorithms/PyramidReader.cpp Wed Sep 11 16:11:16 2024 +0200 @@ -43,6 +43,7 @@ bool hasRawTile_; std::string rawTile_; ImageCompression rawTileCompression_; + bool isEmpty_; std::unique_ptr<Orthanc::ImageAccessor> decoded_; @@ -107,11 +108,13 @@ that_.source_.ReadRawTile(rawTile_, rawTileCompression_, that_.level_, tileX, tileY)) { hasRawTile_ = true; + isEmpty_ = false; } else { hasRawTile_ = false; - decoded_.reset(that_.source_.DecodeTile(that_.level_, tileX, tileY)); + + decoded_.reset(that_.source_.DecodeTile(isEmpty_, that_.level_, tileX, tileY)); if (decoded_.get() == NULL) { throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError); @@ -166,6 +169,11 @@ return *decoded_; } + + bool IsEmpty() const + { + return isEmpty_; + } }; @@ -290,6 +298,7 @@ void PyramidReader::GetDecodedTile(Orthanc::ImageAccessor& target, + bool& isEmpty, unsigned int tileX, unsigned int tileY) { @@ -298,6 +307,7 @@ { // Accessing a tile out of the source image GetOutsideTile().GetReadOnlyAccessor(target); + isEmpty = true; } else { @@ -319,7 +329,8 @@ target.AssignReadOnly(tile.GetFormat(), targetTileWidth_, targetTileHeight_, - tile.GetPitch(), bytes); + tile.GetPitch(), bytes); + isEmpty = source.IsEmpty(); } } }