SlideIO 2.9.0
Open-source library for reading of medical images
Loading...
Searching...
No Matches
phtiffslide.hpp
1// This file is part of slideio project.
2// It is subject to the license terms in the LICENSE file found in the top-level directory
3// of this distribution and at http://slideio.com/license.html.
4#pragma once
5
6#include "slideio/drivers/svs/svsslide.hpp"
7#include "slideio/drivers/svs/phtmetadata.hpp"
8
9namespace slideio
10{
16 struct PHTLevel
17 {
18 int dirIndex = 0;
19 int levelNumber = 0;
20 // True only once PHTIFFSlide::extractImages has confirmed the pairing between this
21 // level and its tiff directory by an exact declared-size comparison; only a
22 // corroborated level may have its tile padding cropped. Defaults to false rather
23 // than true: an unverified pairing must not be cropped, so a level has to earn
24 // "corroborated" by being matched, not receive it by omission.
25 // PHTIFFSlide::extractImages sets the field explicitly on every path it produces,
26 // so the default matters only to code that builds a PHTLevel directly instead of
27 // through it, e.g. the unit tests.
28 bool corroborated = false;
29
30 // Compares only the level/directory pairing, not how sure extractImages was of it:
31 // two levels naming the same directory and level number are the same pairing
32 // whether or not corroborated agrees, which is what the existing tests assert.
33 bool operator==(const PHTLevel& other) const {
34 return dirIndex == other.dirIndex && levelNumber == other.levelNumber;
35 }
36 };
37
38 class SLIDEIO_SVS_EXPORTS PHTIFFSlide : public SVSSlide
39 {
40 public:
41 static std::shared_ptr<SVSSlide> openFile(const std::string& filePath);
42 protected:
43 PHTIFFSlide() = default;
44 void init(const std::vector<TiffDirectory>& directories, TIFFKeeper& keeper) override;
45 MetadataBuilder buildMetadataTree() const override;
46 void extractImages(const std::vector<TiffDirectory>& directories, const PHTMetadata& metadata,
47 std::vector<PHTLevel>& imagePyramid, std::map<std::string, int>& auxImages);
48 void createImageScene(const std::vector<TiffDirectory>& directories, const PHTMetadata& metadata,
49 const std::vector<PHTLevel>& imagePyramid, libtiff::TIFF* tiff);
50 void createAuxScenes(const std::vector<TiffDirectory>& directories,
51 const std::map<std::string, int>& auxImages);
52 };
53}
Definition: exceptions.hpp:15
One zoom level of a philips tiff pyramid: the tiff directory holding the raster and the level number ...
Definition: phtiffslide.hpp:17