diff --git a/executables/WSIArithmetic/WSIArithmetic.cpp b/executables/WSIArithmetic/WSIArithmetic.cpp index 80387ca2..09a0439d 100644 --- a/executables/WSIArithmetic/WSIArithmetic.cpp +++ b/executables/WSIArithmetic/WSIArithmetic.cpp @@ -61,7 +61,7 @@ int main(int argc, char *argv[]) { return 1; } MultiResolutionImageReader reader; - MultiResolutionImage* input = reader.open(inputPth); + std::shared_ptr input = std::shared_ptr(reader.open(inputPth)); CmdLineProgressMonitor monitor; if (input) { ArithmeticWholeSlideFilter fltr; @@ -72,7 +72,6 @@ int main(int argc, char *argv[]) { if (!fltr.process()) { std::cerr << "ERROR: Processing failed" << std::endl; } - delete input; } else { std::cerr << "ERROR: Invalid input image" << std::endl; diff --git a/executables/WSIConnectedComponents/WSIConnectedComponents.cpp b/executables/WSIConnectedComponents/WSIConnectedComponents.cpp index 1ce0e2c0..22db78b8 100644 --- a/executables/WSIConnectedComponents/WSIConnectedComponents.cpp +++ b/executables/WSIConnectedComponents/WSIConnectedComponents.cpp @@ -59,7 +59,7 @@ int main(int argc, char *argv[]) { return 1; } MultiResolutionImageReader reader; - MultiResolutionImage* input = reader.open(inputPth); + std::shared_ptr input = std::shared_ptr(reader.open(inputPth)); CmdLineProgressMonitor monitor; if (input) { ConnectedComponentsWholeSlideFilter fltr; @@ -69,7 +69,6 @@ int main(int argc, char *argv[]) { if (!fltr.process()) { std::cerr << "ERROR: Processing failed" << std::endl; } - delete input; } else { std::cerr << "ERROR: Invalid input image" << std::endl; diff --git a/executables/WSIDistanceTransform/WSIDistanceTransform.cpp b/executables/WSIDistanceTransform/WSIDistanceTransform.cpp index 87f32193..bbdd8496 100644 --- a/executables/WSIDistanceTransform/WSIDistanceTransform.cpp +++ b/executables/WSIDistanceTransform/WSIDistanceTransform.cpp @@ -59,7 +59,7 @@ int main(int argc, char *argv[]) { return 1; } MultiResolutionImageReader reader; - MultiResolutionImage* input = reader.open(inputPth); + std::shared_ptr input = std::shared_ptr(reader.open(inputPth)); CmdLineProgressMonitor monitor; if (input) { DistanceTransformWholeSlideFilter fltr; @@ -70,7 +70,6 @@ int main(int argc, char *argv[]) { if (!fltr.process()) { std::cerr << "ERROR: Processing failed" << std::endl; } - delete input; } else { std::cerr << "ERROR: Invalid input image" << std::endl; diff --git a/executables/WSILabelStatistics/WSILabelStatistics.cpp b/executables/WSILabelStatistics/WSILabelStatistics.cpp index f05dfd2d..fd46a0de 100644 --- a/executables/WSILabelStatistics/WSILabelStatistics.cpp +++ b/executables/WSILabelStatistics/WSILabelStatistics.cpp @@ -59,7 +59,7 @@ int main(int argc, char *argv[]) { return 1; } MultiResolutionImageReader reader; - MultiResolutionImage* input = reader.open(inputPth); + std::shared_ptr input = std::shared_ptr(reader.open(inputPth)); CmdLineProgressMonitor monitor; if (input) { LabelStatisticsWholeSlideFilter fltr; @@ -70,7 +70,6 @@ int main(int argc, char *argv[]) { if (!fltr.process()) { std::cerr << "ERROR: Processing failed" << std::endl; } - delete input; } else { std::cerr << "ERROR: Invalid input image" << std::endl; diff --git a/executables/WSIThreshold/WSIThreshold.cpp b/executables/WSIThreshold/WSIThreshold.cpp index 1c031cd7..218adff2 100644 --- a/executables/WSIThreshold/WSIThreshold.cpp +++ b/executables/WSIThreshold/WSIThreshold.cpp @@ -63,8 +63,8 @@ int main(int argc, char *argv[]) { std::cerr << "Use -h or --help for usage information" << std::endl; return 1; } - MultiResolutionImageReader reader; - MultiResolutionImage* input = reader.open(inputPth); + MultiResolutionImageReader reader; + std::shared_ptr input = std::shared_ptr(reader.open(inputPth)); CmdLineProgressMonitor monitor; if (input) { ThresholdWholeSlideFilter fltr; @@ -77,7 +77,6 @@ int main(int argc, char *argv[]) { if (!fltr.process()) { std::cerr << "ERROR: Processing failed" << std::endl; } - delete input; } else { std::cerr << "ERROR: Invalid input image" << std::endl; diff --git a/imgproc/wholeslide/ArithmeticWholeSlideFilter.cpp b/imgproc/wholeslide/ArithmeticWholeSlideFilter.cpp index 3c77d932..0637a2a5 100644 --- a/imgproc/wholeslide/ArithmeticWholeSlideFilter.cpp +++ b/imgproc/wholeslide/ArithmeticWholeSlideFilter.cpp @@ -10,7 +10,6 @@ #include ArithmeticWholeSlideFilter::ArithmeticWholeSlideFilter() : -_input(NULL), _monitor(NULL), _processedLevel(0), _outPath(""), @@ -20,10 +19,9 @@ _expression("") } ArithmeticWholeSlideFilter::~ArithmeticWholeSlideFilter() { - _input = NULL; } -void ArithmeticWholeSlideFilter::setInput(MultiResolutionImage* const input) { +void ArithmeticWholeSlideFilter::setInput(const std::shared_ptr& input) { _input = input; } @@ -56,8 +54,9 @@ std::string ArithmeticWholeSlideFilter::getExpression() const { } bool ArithmeticWholeSlideFilter::process() { - std::vector dims = this->_input->getLevelDimensions(this->_processedLevel); - double downsample = this->_input->getLevelDownsample(this->_processedLevel); + std::shared_ptr img = _input.lock(); + std::vector dims = img->getLevelDimensions(this->_processedLevel); + double downsample = img->getLevelDownsample(this->_processedLevel); MultiResolutionImageWriter writer; writer.setColorType(pathology::ColorType::Monochrome); @@ -65,7 +64,7 @@ bool ArithmeticWholeSlideFilter::process() { writer.setDataType(pathology::DataType::UInt32); writer.setInterpolation(pathology::Interpolation::NearestNeighbor); writer.setTileSize(512); - std::vector spacing = _input->getSpacing(); + std::vector spacing = img->getSpacing(); if (!spacing.empty()) { spacing[0] *= downsample; spacing[1] *= downsample; @@ -89,7 +88,7 @@ bool ArithmeticWholeSlideFilter::process() { unsigned int* out_tile = new unsigned int[512 * 512]; for (unsigned long long t_y = 0; t_y < dims[1]; t_y += 512) { for (unsigned long long t_x = 0; t_x < dims[0]; t_x += 512) { - this->_input->getRawRegion(static_cast(t_x*downsample), static_cast(t_y*downsample), 512, 512, this->_processedLevel, tile); + img->getRawRegion(static_cast(t_x*downsample), static_cast(t_y*downsample), 512, 512, this->_processedLevel, tile); for (unsigned int y = 0; y < 512; ++y) { for (unsigned int x = 0; x < 512; ++x) { float curVal = tile[y * 512 + x]; diff --git a/imgproc/wholeslide/ArithmeticWholeSlideFilter.h b/imgproc/wholeslide/ArithmeticWholeSlideFilter.h index f6f89ecb..2fbec0ad 100644 --- a/imgproc/wholeslide/ArithmeticWholeSlideFilter.h +++ b/imgproc/wholeslide/ArithmeticWholeSlideFilter.h @@ -5,6 +5,7 @@ #include #include #include +#include class MultiResolutionImage; class ProgressMonitor; @@ -12,7 +13,7 @@ class ProgressMonitor; class EXPORT_WHOLESLIDEFILTERS ArithmeticWholeSlideFilter { private: - MultiResolutionImage* _input; + std::weak_ptr _input; ProgressMonitor* _monitor; unsigned int _processedLevel; std::string _outPath; @@ -22,7 +23,7 @@ class EXPORT_WHOLESLIDEFILTERS ArithmeticWholeSlideFilter { ArithmeticWholeSlideFilter(); virtual ~ArithmeticWholeSlideFilter(); - void setInput(MultiResolutionImage* const input); + void setInput(const std::shared_ptr& input); void setProcessedLevel(const unsigned int processedLevel); unsigned int getProcessedLevel(); void setProgressMonitor(ProgressMonitor* progressMonitor); diff --git a/imgproc/wholeslide/ConnectedComponentsWholeSlideFilter.cpp b/imgproc/wholeslide/ConnectedComponentsWholeSlideFilter.cpp index 041a741a..7850d49b 100644 --- a/imgproc/wholeslide/ConnectedComponentsWholeSlideFilter.cpp +++ b/imgproc/wholeslide/ConnectedComponentsWholeSlideFilter.cpp @@ -111,7 +111,6 @@ void ConnectedComponentsWholeSlideFilter::DisjointSet::addElements(int numToAdd) } ConnectedComponentsWholeSlideFilter::ConnectedComponentsWholeSlideFilter() : -_input(NULL), _monitor(NULL), _processedLevel(0), _outPath(""), @@ -121,10 +120,9 @@ _threshold(0.5) } ConnectedComponentsWholeSlideFilter::~ConnectedComponentsWholeSlideFilter() { - _input = NULL; } -void ConnectedComponentsWholeSlideFilter::setInput(MultiResolutionImage* const input) { +void ConnectedComponentsWholeSlideFilter::setInput(const std::shared_ptr& input) { _input = input; } @@ -157,8 +155,9 @@ float ConnectedComponentsWholeSlideFilter::getThreshold() { } bool ConnectedComponentsWholeSlideFilter::process() const { - std::vector dims = this->_input->getLevelDimensions(this->_processedLevel); - double downsample = this->_input->getLevelDownsample(this->_processedLevel); + std::shared_ptr img = _input.lock(); + std::vector dims = img->getLevelDimensions(this->_processedLevel); + double downsample = img->getLevelDownsample(this->_processedLevel); MultiResolutionImageWriter writer; writer.setColorType(pathology::ColorType::Monochrome); @@ -166,7 +165,7 @@ bool ConnectedComponentsWholeSlideFilter::process() const { writer.setDataType(pathology::DataType::UInt32); writer.setInterpolation(pathology::Interpolation::NearestNeighbor); writer.setTileSize(512); - std::vector spacing = _input->getSpacing(); + std::vector spacing = img->getSpacing(); if (!spacing.empty()) { spacing[0] *= downsample; spacing[1] *= downsample; @@ -197,7 +196,7 @@ bool ConnectedComponentsWholeSlideFilter::process() const { for (unsigned long long t_y = 0; t_y < dims[1]; t_y += 512) { std::fill(buffer_t_x, buffer_t_x + 512, 0); for (unsigned long long t_x = 0; t_x < dims[0]; t_x += 512) { - this->_input->getRawRegion(static_cast(t_x*downsample), static_cast(t_y*downsample), 512, 512, this->_processedLevel, tile); + img->getRawRegion(static_cast(t_x*downsample), static_cast(t_y*downsample), 512, 512, this->_processedLevel, tile); std::fill(label_tile, label_tile + 512 * 512, 0); for (int y = 0; y < 512; ++y) { for (int x = 0; x < 512; ++x) { diff --git a/imgproc/wholeslide/ConnectedComponentsWholeSlideFilter.h b/imgproc/wholeslide/ConnectedComponentsWholeSlideFilter.h index 7427cab3..2eafb24c 100644 --- a/imgproc/wholeslide/ConnectedComponentsWholeSlideFilter.h +++ b/imgproc/wholeslide/ConnectedComponentsWholeSlideFilter.h @@ -4,6 +4,7 @@ #include "config/pathology_config.h" #include #include +#include class MultiResolutionImage; class ProgressMonitor; @@ -11,7 +12,7 @@ class ProgressMonitor; class EXPORT_WHOLESLIDEFILTERS ConnectedComponentsWholeSlideFilter { private: - MultiResolutionImage* _input; + std::weak_ptr _input; ProgressMonitor* _monitor; unsigned int _processedLevel; std::string _outPath; @@ -62,7 +63,7 @@ class EXPORT_WHOLESLIDEFILTERS ConnectedComponentsWholeSlideFilter { ConnectedComponentsWholeSlideFilter(); virtual ~ConnectedComponentsWholeSlideFilter(); - void setInput(MultiResolutionImage* const input); + void setInput(const std::shared_ptr& input); void setProcessedLevel(const unsigned int processedLevel); unsigned int getProcessedLevel(); void setProgressMonitor(ProgressMonitor* progressMonitor); diff --git a/imgproc/wholeslide/DistanceTransformWholeSlideFilter.cpp b/imgproc/wholeslide/DistanceTransformWholeSlideFilter.cpp index 8c341661..cf3903e0 100644 --- a/imgproc/wholeslide/DistanceTransformWholeSlideFilter.cpp +++ b/imgproc/wholeslide/DistanceTransformWholeSlideFilter.cpp @@ -7,7 +7,6 @@ #include DistanceTransformWholeSlideFilter::DistanceTransformWholeSlideFilter() : -_input(NULL), _monitor(NULL), _processedLevel(0), _outPath("") @@ -16,10 +15,9 @@ _outPath("") } DistanceTransformWholeSlideFilter::~DistanceTransformWholeSlideFilter() { - _input = NULL; } -void DistanceTransformWholeSlideFilter::setInput(MultiResolutionImage* const input) { +void DistanceTransformWholeSlideFilter::setInput(const std::shared_ptr& input) { _input = input; } @@ -44,8 +42,9 @@ ProgressMonitor* DistanceTransformWholeSlideFilter::getProgressMonitor() { } bool DistanceTransformWholeSlideFilter::process() const { - std::vector dims = this->_input->getLevelDimensions(this->_processedLevel); - double downsample = this->_input->getLevelDownsample(this->_processedLevel); + std::shared_ptr img = _input.lock(); + std::vector dims = img->getLevelDimensions(this->_processedLevel); + double downsample = img->getLevelDownsample(this->_processedLevel); MultiResolutionImageWriter writer; writer.setColorType(pathology::ColorType::Monochrome); @@ -53,7 +52,7 @@ bool DistanceTransformWholeSlideFilter::process() const { writer.setDataType(pathology::DataType::UInt32); writer.setInterpolation(pathology::Interpolation::NearestNeighbor); writer.setTileSize(512); - std::vector spacing = _input->getSpacing(); + std::vector spacing = img->getSpacing(); if (!spacing.empty()) { spacing[0] *= downsample; spacing[1] *= downsample; @@ -83,7 +82,7 @@ bool DistanceTransformWholeSlideFilter::process() const { for (unsigned long long t_y = 0; t_y < dims[1]; t_y += 512) { std::fill(buffer_t_x, buffer_t_x + 512, maxDist); for (unsigned long long t_x = 0; t_x < dims[0]; t_x += 512) { - this->_input->getRawRegion(static_cast(t_x*downsample), static_cast(t_y*downsample), 512, 512, this->_processedLevel, tile); + img->getRawRegion(static_cast(t_x*downsample), static_cast(t_y*downsample), 512, 512, this->_processedLevel, tile); std::fill(out_tile, out_tile + 512 * 512, (dims[0] + dims[1] / 2) + 1); int startX = 0; int startY = 0; diff --git a/imgproc/wholeslide/DistanceTransformWholeSlideFilter.h b/imgproc/wholeslide/DistanceTransformWholeSlideFilter.h index 3b7b2639..d9d653c3 100644 --- a/imgproc/wholeslide/DistanceTransformWholeSlideFilter.h +++ b/imgproc/wholeslide/DistanceTransformWholeSlideFilter.h @@ -4,6 +4,7 @@ #include "config/pathology_config.h" #include #include +#include class MultiResolutionImage; class ProgressMonitor; @@ -11,7 +12,7 @@ class ProgressMonitor; class EXPORT_WHOLESLIDEFILTERS DistanceTransformWholeSlideFilter { private: - MultiResolutionImage* _input; + std::weak_ptr _input; ProgressMonitor* _monitor; unsigned int _processedLevel; std::string _outPath; @@ -20,7 +21,7 @@ class EXPORT_WHOLESLIDEFILTERS DistanceTransformWholeSlideFilter { DistanceTransformWholeSlideFilter(); virtual ~DistanceTransformWholeSlideFilter(); - void setInput(MultiResolutionImage* const input); + void setInput(const std::shared_ptr& input); void setProcessedLevel(const unsigned int processedLevel); unsigned int getProcessedLevel(); void setProgressMonitor(ProgressMonitor* progressMonitor); diff --git a/imgproc/wholeslide/LabelStatisticsWholeSlideFilter.cpp b/imgproc/wholeslide/LabelStatisticsWholeSlideFilter.cpp index 90453b70..28410d89 100644 --- a/imgproc/wholeslide/LabelStatisticsWholeSlideFilter.cpp +++ b/imgproc/wholeslide/LabelStatisticsWholeSlideFilter.cpp @@ -9,7 +9,6 @@ #include LabelStatisticsWholeSlideFilter::LabelStatisticsWholeSlideFilter() : -_input(NULL), _monitor(NULL), _processedLevel(0), _outPath("") @@ -18,10 +17,9 @@ _outPath("") } LabelStatisticsWholeSlideFilter::~LabelStatisticsWholeSlideFilter() { - _input = NULL; } -void LabelStatisticsWholeSlideFilter::setInput(MultiResolutionImage* const input) { +void LabelStatisticsWholeSlideFilter::setInput(const std::shared_ptr& input) { _input = input; } @@ -51,8 +49,9 @@ std::vector > LabelStatisticsWholeSlideFilter::getLabelStatis bool LabelStatisticsWholeSlideFilter::process() { _labelStats.clear(); - std::vector dims = this->_input->getLevelDimensions(this->_processedLevel); - double downsample = this->_input->getLevelDownsample(this->_processedLevel); + std::shared_ptr img = _input.lock(); + std::vector dims = img->getLevelDimensions(this->_processedLevel); + double downsample = img->getLevelDownsample(this->_processedLevel); std::ofstream csvfile; if (!_outPath.empty()) { @@ -66,7 +65,7 @@ bool LabelStatisticsWholeSlideFilter::process() { unsigned int* tile = new unsigned int[512 * 512]; for (unsigned long long t_y = 0; t_y < dims[1]; t_y += 512) { for (unsigned long long t_x = 0; t_x < dims[0]; t_x += 512) { - this->_input->getRawRegion(static_cast(t_x*downsample), static_cast(t_y*downsample), 512, 512, this->_processedLevel, tile); + img->getRawRegion(static_cast(t_x*downsample), static_cast(t_y*downsample), 512, 512, this->_processedLevel, tile); for (unsigned int y = 0; y < 512; ++y) { for (unsigned int x = 0; x < 512; ++x) { unsigned int curVal = tile[y * 512 + x]; diff --git a/imgproc/wholeslide/LabelStatisticsWholeSlideFilter.h b/imgproc/wholeslide/LabelStatisticsWholeSlideFilter.h index 852fa3c7..4bbdc43c 100644 --- a/imgproc/wholeslide/LabelStatisticsWholeSlideFilter.h +++ b/imgproc/wholeslide/LabelStatisticsWholeSlideFilter.h @@ -5,6 +5,7 @@ #include #include #include +#include class MultiResolutionImage; class ProgressMonitor; @@ -12,7 +13,7 @@ class ProgressMonitor; class EXPORT_WHOLESLIDEFILTERS LabelStatisticsWholeSlideFilter { private: - MultiResolutionImage* _input; + std::weak_ptr _input; ProgressMonitor* _monitor; unsigned int _processedLevel; std::string _outPath; @@ -22,7 +23,7 @@ class EXPORT_WHOLESLIDEFILTERS LabelStatisticsWholeSlideFilter { LabelStatisticsWholeSlideFilter(); virtual ~LabelStatisticsWholeSlideFilter(); - void setInput(MultiResolutionImage* const input); + void setInput(const std::shared_ptr& input); void setProcessedLevel(const unsigned int processedLevel); unsigned int getProcessedLevel(); void setProgressMonitor(ProgressMonitor* progressMonitor); diff --git a/imgproc/wholeslide/ThresholdWholeSlideFilter.cpp b/imgproc/wholeslide/ThresholdWholeSlideFilter.cpp index 187cb72a..aae753c1 100644 --- a/imgproc/wholeslide/ThresholdWholeSlideFilter.cpp +++ b/imgproc/wholeslide/ThresholdWholeSlideFilter.cpp @@ -9,7 +9,6 @@ #include ThresholdWholeSlideFilter::ThresholdWholeSlideFilter() : -_input(NULL), _monitor(NULL), _processedLevel(0), _outPath(""), @@ -21,10 +20,9 @@ _component(-1) } ThresholdWholeSlideFilter::~ThresholdWholeSlideFilter() { - _input = NULL; } -void ThresholdWholeSlideFilter::setInput(MultiResolutionImage* const input) { +void ThresholdWholeSlideFilter::setInput(const std::shared_ptr& input) { _input = input; } @@ -73,28 +71,29 @@ int ThresholdWholeSlideFilter::getComponent() const { } bool ThresholdWholeSlideFilter::process() { - std::vector dims = this->_input->getLevelDimensions(this->_processedLevel); - double downsample = this->_input->getLevelDownsample(this->_processedLevel); + std::shared_ptr img = _input.lock(); + std::vector dims = img->getLevelDimensions(this->_processedLevel); + double downsample = img->getLevelDownsample(this->_processedLevel); MultiResolutionImageWriter writer; - unsigned int outSamplesPerPixel = _input->getSamplesPerPixel(); - unsigned int inSamplesPerPixel = _input->getSamplesPerPixel(); + unsigned int outSamplesPerPixel = img->getSamplesPerPixel(); + unsigned int inSamplesPerPixel = img->getSamplesPerPixel(); if (_component >= inSamplesPerPixel) { std::cerr << "ERROR: Selected component is larger than number of input components, fallback to all components" << std::endl; _component = -1; } - if (_component >= 0 || _input->getSamplesPerPixel() == 1) { + if (_component >= 0 || img->getSamplesPerPixel() == 1) { writer.setColorType(pathology::ColorType::Monochrome); outSamplesPerPixel = 1; } else { writer.setColorType(pathology::ColorType::Indexed); - writer.setNumberOfIndexedColors(_input->getSamplesPerPixel()); + writer.setNumberOfIndexedColors(img->getSamplesPerPixel()); } writer.setCompression(pathology::Compression::LZW); writer.setDataType(pathology::DataType::UChar); writer.setInterpolation(pathology::Interpolation::NearestNeighbor); writer.setTileSize(512); - std::vector spacing = _input->getSpacing(); + std::vector spacing = img->getSpacing(); if (!spacing.empty()) { spacing[0] *= downsample; spacing[1] *= downsample; @@ -107,14 +106,14 @@ bool ThresholdWholeSlideFilter::process() { writer.setProgressMonitor(_monitor); writer.writeImageInformation(dims[0], dims[1]); - float* tile = new float[512 * 512 * _input->getSamplesPerPixel()]; + float* tile = new float[512 * 512 * img->getSamplesPerPixel()]; unsigned char* out_tile = new unsigned char[512 * 512 * outSamplesPerPixel]; for (unsigned long long t_y = 0; t_y < dims[1]; t_y += 512) { for (unsigned long long t_x = 0; t_x < dims[0]; t_x += 512) { - this->_input->getRawRegion(static_cast(t_x*downsample), static_cast(t_y*downsample), 512, 512, this->_processedLevel, tile); + img->getRawRegion(static_cast(t_x*downsample), static_cast(t_y*downsample), 512, 512, this->_processedLevel, tile); for (unsigned int y = 0; y < 512; ++y) { for (unsigned int x = 0; x < 512; ++x) { - for (unsigned int c = 0; c < _input->getSamplesPerPixel(); ++c) { + for (unsigned int c = 0; c < img->getSamplesPerPixel(); ++c) { if (c == _component) { float curVal = tile[y * 512 * inSamplesPerPixel + x * inSamplesPerPixel + c]; if (curVal >= _lowerThreshold && curVal < _upperThreshold) { diff --git a/imgproc/wholeslide/ThresholdWholeSlideFilter.h b/imgproc/wholeslide/ThresholdWholeSlideFilter.h index 67dbff1f..2e63a548 100644 --- a/imgproc/wholeslide/ThresholdWholeSlideFilter.h +++ b/imgproc/wholeslide/ThresholdWholeSlideFilter.h @@ -5,6 +5,7 @@ #include #include #include +#include class MultiResolutionImage; class ProgressMonitor; @@ -12,7 +13,7 @@ class ProgressMonitor; class EXPORT_WHOLESLIDEFILTERS ThresholdWholeSlideFilter { private: - MultiResolutionImage* _input; + std::weak_ptr _input; ProgressMonitor* _monitor; unsigned int _processedLevel; std::string _outPath; @@ -25,7 +26,7 @@ class EXPORT_WHOLESLIDEFILTERS ThresholdWholeSlideFilter { ThresholdWholeSlideFilter(); virtual ~ThresholdWholeSlideFilter(); - void setInput(MultiResolutionImage* const input); + void setInput(const std::shared_ptr& input); void setProcessedLevel(const unsigned int processedLevel); unsigned int getProcessedLevel(); void setProgressMonitor(ProgressMonitor* progressMonitor);