Mercurial > hg > orthanc-wsi
changeset 199:a1c265cb2174
replacing deprecated std::auto_ptr by std::unique_ptr
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 06 Jul 2020 16:29:41 +0200 |
parents | 2d3fe6967894 |
children | e99947a7e3c8 |
files | Applications/ApplicationToolbox.cpp Applications/DicomToTiff.cpp Applications/Dicomizer.cpp Framework/Algorithms/PyramidReader.cpp Framework/Algorithms/PyramidReader.h Framework/Algorithms/ReconstructPyramidCommand.cpp Framework/DicomToolbox.cpp Framework/ImageToolbox.cpp Framework/Inputs/DecodedTiledPyramid.cpp Framework/Inputs/OpenSlideLibrary.cpp Framework/Inputs/OpenSlidePyramid.cpp Framework/Jpeg2000Reader.cpp Framework/Jpeg2000Reader.h Framework/MultiThreading/BagOfTasksProcessor.cpp Framework/Outputs/DicomPyramidWriter.cpp Framework/Outputs/InMemoryTiledImage.cpp Framework/Outputs/MultiframeDicomWriter.cpp Framework/Outputs/MultiframeDicomWriter.h Framework/Targets/OrthancTarget.h ViewerPlugin/DicomPyramidCache.cpp ViewerPlugin/Plugin.cpp |
diffstat | 21 files changed, 110 insertions(+), 79 deletions(-) [+] |
line wrap: on
line diff
--- a/Applications/ApplicationToolbox.cpp Mon Jul 06 16:17:09 2020 +0200 +++ b/Applications/ApplicationToolbox.cpp Mon Jul 06 16:29:41 2020 +0200 @@ -24,6 +24,7 @@ #include "../Framework/Inputs/OpenSlideLibrary.h" #include "../Framework/MultiThreading/BagOfTasksProcessor.h" +#include <Compatibility.h> // For std::unique_ptr #include <DicomParsing/FromDcmtkBridge.h> #include <HttpClient.h> #include <Logging.h> @@ -107,7 +108,7 @@ LOG(WARNING) << "Running " << tasks.GetSize() << " tasks"; LOG(WARNING) << "Using " << threadsCount << " threads for the computation"; Orthanc::BagOfTasksProcessor processor(threadsCount); - std::auto_ptr<Orthanc::BagOfTasksProcessor::Handle> handle(processor.Submit(tasks)); + std::unique_ptr<Orthanc::BagOfTasksProcessor::Handle> handle(processor.Submit(tasks)); // Start a thread to display the progress bool done = false; @@ -144,7 +145,7 @@ // No multithreading while (!tasks.IsEmpty()) { - std::auto_ptr<Orthanc::ICommand> task(tasks.Pop()); + std::unique_ptr<Orthanc::ICommand> task(tasks.Pop()); if (task->Execute()) { unsigned int progress = static_cast<unsigned int>(100.0f *
--- a/Applications/DicomToTiff.cpp Mon Jul 06 16:17:09 2020 +0200 +++ b/Applications/DicomToTiff.cpp Mon Jul 06 16:29:41 2020 +0200 @@ -26,6 +26,7 @@ #include "../Framework/Outputs/HierarchicalTiffWriter.h" #include "../Resources/Orthanc/Stone/OrthancHttpConnection.h" +#include <Compatibility.h> // For std::unique_ptr #include <Logging.h> #include <OrthancException.h> @@ -159,7 +160,7 @@ static Orthanc::ImageAccessor* CreateEmptyTile(const OrthancWSI::IPyramidWriter& writer, const boost::program_options::variables_map& options) { - std::auto_ptr<Orthanc::ImageAccessor> tile + std::unique_ptr<Orthanc::ImageAccessor> tile (OrthancWSI::ImageToolbox::Allocate(writer.GetPixelFormat(), writer.GetTileWidth(), writer.GetTileHeight())); @@ -213,7 +214,7 @@ LOG(WARNING) << "Source photometric interpretation: " << EnumerationToString(source.GetPhotometricInterpretation()); LOG(WARNING) << "Target photometric interpretation: " << EnumerationToString(targetPhotometric); - std::auto_ptr<Orthanc::ImageAccessor> empty(CreateEmptyTile(target, options)); + std::unique_ptr<Orthanc::ImageAccessor> empty(CreateEmptyTile(target, options)); for (unsigned int level = 0; level < source.GetLevelCount(); level++) { @@ -254,7 +255,7 @@ } else if (reencode) { - std::auto_ptr<Orthanc::ImageAccessor> decoded; + std::unique_ptr<Orthanc::ImageAccessor> decoded; if (compression == OrthancWSI::ImageCompression_None) {
--- a/Applications/Dicomizer.cpp Mon Jul 06 16:17:09 2020 +0200 +++ b/Applications/Dicomizer.cpp Mon Jul 06 16:29:41 2020 +0200 @@ -33,6 +33,7 @@ #include "../Framework/Outputs/DicomPyramidWriter.h" #include "../Framework/Outputs/TruncatedPyramidWriter.h" +#include <Compatibility.h> // For std::unique_ptr #include <DicomParsing/FromDcmtkBridge.h> #include <Logging.h> #include <OrthancException.h> @@ -300,7 +301,7 @@ } } - std::auto_ptr<DcmDataset> dataset(Orthanc::FromDcmtkBridge::FromJson(json, true, true, Orthanc::Encoding_Latin1, + std::unique_ptr<DcmDataset> dataset(Orthanc::FromDcmtkBridge::FromJson(json, true, true, Orthanc::Encoding_Latin1, "" /* no private tag, thus no private creator */)); if (dataset.get() == NULL) { @@ -359,10 +360,10 @@ { // Construct tag "Dimension Organization Sequence" (0020,9221) - std::auto_ptr<DcmItem> item(new DcmItem); + std::unique_ptr<DcmItem> item(new DcmItem); OrthancWSI::DicomToolbox::SetStringTag(*item, DCM_DimensionOrganizationUID, organization); - std::auto_ptr<DcmSequenceOfItems> sequence(new DcmSequenceOfItems(DCM_DimensionOrganizationSequence)); + std::unique_ptr<DcmSequenceOfItems> sequence(new DcmSequenceOfItems(DCM_DimensionOrganizationSequence)); if (!sequence->insert(item.release(), false, false).good() || !dataset.insert(sequence.release(), true /* replace */, false).good()) @@ -374,17 +375,17 @@ { // Construct tag "Dimension Index Sequence" (0020,9222) - std::auto_ptr<DcmItem> item(new DcmItem); + std::unique_ptr<DcmItem> item(new DcmItem); OrthancWSI::DicomToolbox::SetStringTag(*item, DCM_DimensionOrganizationUID, organization); OrthancWSI::DicomToolbox::SetAttributeTag(*item, DCM_FunctionalGroupPointer, DCM_PlanePositionSlideSequence); OrthancWSI::DicomToolbox::SetAttributeTag(*item, DCM_DimensionIndexPointer, DCM_ColumnPositionInTotalImagePixelMatrix); - std::auto_ptr<DcmItem> item2(new DcmItem); + std::unique_ptr<DcmItem> item2(new DcmItem); OrthancWSI::DicomToolbox::SetStringTag(*item2, DCM_DimensionOrganizationUID, organization); OrthancWSI::DicomToolbox::SetAttributeTag(*item2, DCM_FunctionalGroupPointer, DCM_PlanePositionSlideSequence); OrthancWSI::DicomToolbox::SetAttributeTag(*item2, DCM_DimensionIndexPointer, DCM_RowPositionInTotalImagePixelMatrix); - std::auto_ptr<DcmSequenceOfItems> sequence(new DcmSequenceOfItems(DCM_DimensionIndexSequence)); + std::unique_ptr<DcmSequenceOfItems> sequence(new DcmSequenceOfItems(DCM_DimensionIndexSequence)); if (!sequence->insert(item.release(), false, false).good() || !sequence->insert(item2.release(), false, false).good() || @@ -397,13 +398,13 @@ { // Construct tag "Shared Functional Groups Sequence" (5200,9229) - std::auto_ptr<DcmItem> item(new DcmItem); + std::unique_ptr<DcmItem> item(new DcmItem); - std::auto_ptr<DcmItem> item3(new DcmItem); + std::unique_ptr<DcmItem> item3(new DcmItem); OrthancWSI::DicomToolbox::SetStringTag(*item3, DCM_OpticalPathIdentifier, opticalPathId); - std::auto_ptr<DcmSequenceOfItems> sequence(new DcmSequenceOfItems(DCM_SharedFunctionalGroupsSequence)); - std::auto_ptr<DcmSequenceOfItems> sequence3(new DcmSequenceOfItems(DCM_OpticalPathIdentificationSequence)); + std::unique_ptr<DcmSequenceOfItems> sequence(new DcmSequenceOfItems(DCM_SharedFunctionalGroupsSequence)); + std::unique_ptr<DcmSequenceOfItems> sequence3(new DcmSequenceOfItems(DCM_OpticalPathIdentificationSequence)); if (!sequence3->insert(item3.release(), false, false).good() || !item->insert(sequence3.release(), false, false).good() || @@ -441,13 +442,13 @@ OrthancWSI::DicomToolbox::SetStringTag(dataset, DCM_ImagedVolumeHeight, boost::lexical_cast<std::string>(volume.GetHeight())); OrthancWSI::DicomToolbox::SetStringTag(dataset, DCM_ImagedVolumeDepth, boost::lexical_cast<std::string>(volume.GetDepth())); - std::auto_ptr<DcmItem> origin(new DcmItem); + std::unique_ptr<DcmItem> origin(new DcmItem); OrthancWSI::DicomToolbox::SetStringTag(*origin, DCM_XOffsetInSlideCoordinateSystem, boost::lexical_cast<std::string>(volume.GetOffsetX())); OrthancWSI::DicomToolbox::SetStringTag(*origin, DCM_YOffsetInSlideCoordinateSystem, boost::lexical_cast<std::string>(volume.GetOffsetY())); - std::auto_ptr<DcmSequenceOfItems> sequenceOrigin(new DcmSequenceOfItems(DCM_TotalPixelMatrixOriginSequence)); + std::unique_ptr<DcmSequenceOfItems> sequenceOrigin(new DcmSequenceOfItems(DCM_TotalPixelMatrixOriginSequence)); if (!sequenceOrigin->insert(origin.release(), false, false).good() || !dataset.insert(sequenceOrigin.release(), false, false).good()) { @@ -473,7 +474,7 @@ throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError); } - std::auto_ptr<DcmElement> element(Orthanc::FromDcmtkBridge::FromJson( + std::unique_ptr<DcmElement> element(Orthanc::FromDcmtkBridge::FromJson( Orthanc::DicomTag(DCM_OpticalPathSequence.getGroup(), DCM_OpticalPathSequence.getElement()), json, false, encoding, @@ -505,7 +506,7 @@ if (!opticalPath->tagExists(DCM_ICCProfile)) { - std::auto_ptr<DcmOtherByteOtherWord> icc(new DcmOtherByteOtherWord(DCM_ICCProfile)); + std::unique_ptr<DcmOtherByteOtherWord> icc(new DcmOtherByteOtherWord(DCM_ICCProfile)); if (!icc->putUint8Array(reinterpret_cast<const Uint8*>(profile.c_str()), profile.size()).good() || !opticalPath->insert(icc.release()).good()) @@ -927,7 +928,7 @@ { try { - std::auto_ptr<OrthancWSI::HierarchicalTiff> tiff(new OrthancWSI::HierarchicalTiff(path)); + std::unique_ptr<OrthancWSI::HierarchicalTiff> tiff(new OrthancWSI::HierarchicalTiff(path)); sourceCompression = tiff->GetImageCompression(); return tiff.release(); } @@ -972,7 +973,7 @@ if (ParseParameters(exitStatus, parameters, volume, argc, argv)) { OrthancWSI::ImageCompression sourceCompression; - std::auto_ptr<OrthancWSI::ITiledPyramid> source; + std::unique_ptr<OrthancWSI::ITiledPyramid> source; source.reset(OpenInputPyramid(sourceCompression, parameters.GetInputFile(), parameters)); if (source.get() == NULL) @@ -983,10 +984,10 @@ LOG(WARNING) << "Compression of the individual source tiles: " << OrthancWSI::EnumerationToString(sourceCompression); // Create the shared DICOM tags - std::auto_ptr<DcmDataset> dataset(ParseDataset(parameters.GetDatasetPath())); + std::unique_ptr<DcmDataset> dataset(ParseDataset(parameters.GetDatasetPath())); EnrichDataset(*dataset, *source, sourceCompression, parameters, volume); - std::auto_ptr<OrthancWSI::IFileTarget> output(parameters.CreateTarget()); + std::unique_ptr<OrthancWSI::IFileTarget> output(parameters.CreateTarget()); Recompress(*output, *source, *dataset, parameters, volume, sourceCompression); } }
--- a/Framework/Algorithms/PyramidReader.cpp Mon Jul 06 16:17:09 2020 +0200 +++ b/Framework/Algorithms/PyramidReader.cpp Mon Jul 06 16:29:41 2020 +0200 @@ -23,6 +23,8 @@ #include "PyramidReader.h" #include "../ImageToolbox.h" + +#include <Compatibility.h> // For std::unique_ptr #include <Logging.h> #include <OrthancException.h> @@ -40,7 +42,7 @@ std::string rawTile_; ImageCompression rawTileCompression_; - std::auto_ptr<Orthanc::ImageAccessor> decoded_; + std::unique_ptr<Orthanc::ImageAccessor> decoded_; bool IsRepaintNeeded() const { @@ -197,7 +199,7 @@ { if (parameters_.IsSafetyCheck()) { - std::auto_ptr<Orthanc::ImageAccessor> decoded(ImageToolbox::DecodeTile(tile, compression)); + std::unique_ptr<Orthanc::ImageAccessor> decoded(ImageToolbox::DecodeTile(tile, compression)); CheckTileSize(*decoded); } }
--- a/Framework/Algorithms/PyramidReader.h Mon Jul 06 16:17:09 2020 +0200 +++ b/Framework/Algorithms/PyramidReader.h Mon Jul 06 16:29:41 2020 +0200 @@ -24,6 +24,8 @@ #include "../Inputs/ITiledPyramid.h" #include "../DicomizerParameters.h" +#include <Compatibility.h> // For std::unique_ptr + #include <map> #include <memory> @@ -50,7 +52,7 @@ Cache cache_; - std::auto_ptr<Orthanc::ImageAccessor> outside_; + std::unique_ptr<Orthanc::ImageAccessor> outside_; Orthanc::ImageAccessor& GetOutsideTile();
--- a/Framework/Algorithms/ReconstructPyramidCommand.cpp Mon Jul 06 16:17:09 2020 +0200 +++ b/Framework/Algorithms/ReconstructPyramidCommand.cpp Mon Jul 06 16:29:41 2020 +0200 @@ -23,6 +23,8 @@ #include "ReconstructPyramidCommand.h" #include "../ImageToolbox.h" + +#include <Compatibility.h> // For std::unique_ptr #include <Logging.h> #include <OrthancException.h> #include <Images/Image.h> @@ -46,7 +48,7 @@ return NULL; } - std::auto_ptr<Orthanc::ImageAccessor> result; + std::unique_ptr<Orthanc::ImageAccessor> result; if (level == 0) { @@ -69,7 +71,7 @@ } else { - std::auto_ptr<Orthanc::ImageAccessor> mosaic(ImageToolbox::Allocate(source_.GetPixelFormat(), + std::unique_ptr<Orthanc::ImageAccessor> mosaic(ImageToolbox::Allocate(source_.GetPixelFormat(), 2 * target_.GetTileWidth(), 2 * target_.GetTileHeight())); ImageToolbox::Set(*mosaic, @@ -78,7 +80,7 @@ source_.GetParameters().GetBackgroundColorBlue()); { - std::auto_ptr<Orthanc::ImageAccessor> subTile(Explore(level - 1, 2 * offsetX, 2 * offsetY)); + std::unique_ptr<Orthanc::ImageAccessor> subTile(Explore(level - 1, 2 * offsetX, 2 * offsetY)); if (subTile.get() != NULL) { ImageToolbox::Embed(*mosaic, *subTile, 0, 0); @@ -86,7 +88,7 @@ } { - std::auto_ptr<Orthanc::ImageAccessor> subTile(Explore(level - 1, 2 * offsetX + 1, 2 * offsetY)); + std::unique_ptr<Orthanc::ImageAccessor> subTile(Explore(level - 1, 2 * offsetX + 1, 2 * offsetY)); if (subTile.get() != NULL) { ImageToolbox::Embed(*mosaic, *subTile, target_.GetTileWidth(), 0); @@ -94,7 +96,7 @@ } { - std::auto_ptr<Orthanc::ImageAccessor> subTile(Explore(level - 1, 2 * offsetX, 2 * offsetY + 1)); + std::unique_ptr<Orthanc::ImageAccessor> subTile(Explore(level - 1, 2 * offsetX, 2 * offsetY + 1)); if (subTile.get() != NULL) { ImageToolbox::Embed(*mosaic, *subTile, 0, target_.GetTileHeight()); @@ -102,7 +104,7 @@ } { - std::auto_ptr<Orthanc::ImageAccessor> subTile(Explore(level - 1, 2 * offsetX + 1, 2 * offsetY + 1)); + std::unique_ptr<Orthanc::ImageAccessor> subTile(Explore(level - 1, 2 * offsetX + 1, 2 * offsetY + 1)); if (subTile.get() != NULL) { ImageToolbox::Embed(*mosaic, *subTile, target_.GetTileWidth(), target_.GetTileHeight()); @@ -147,7 +149,7 @@ bool ReconstructPyramidCommand::Execute() { - std::auto_ptr<Orthanc::ImageAccessor> root(Explore(upToLevel_, 0, 0)); + std::unique_ptr<Orthanc::ImageAccessor> root(Explore(upToLevel_, 0, 0)); return true; } @@ -177,7 +179,7 @@ { for (unsigned int x = 0; x < targetCountTilesX; x += step) { - std::auto_ptr<ReconstructPyramidCommand> command; + std::unique_ptr<ReconstructPyramidCommand> command; command.reset(new ReconstructPyramidCommand (target, source, countLevels - 1, x, y, parameters)); command->SetShiftTargetLevel(shiftTargetLevel);
--- a/Framework/DicomToolbox.cpp Mon Jul 06 16:17:09 2020 +0200 +++ b/Framework/DicomToolbox.cpp Mon Jul 06 16:29:41 2020 +0200 @@ -22,6 +22,7 @@ #include "PrecompiledHeadersWSI.h" #include "DicomToolbox.h" +#include <Compatibility.h> // For std::unique_ptr #include <Logging.h> #include <OrthancException.h> #include <Toolbox.h> @@ -79,7 +80,7 @@ { if (!dataset.tagExists(key)) { - std::auto_ptr<DcmAttributeTag> tag(new DcmAttributeTag(key)); + std::unique_ptr<DcmAttributeTag> tag(new DcmAttributeTag(key)); if (!tag->putTagVal(value).good() || !dataset.insert(tag.release()).good())
--- a/Framework/ImageToolbox.cpp Mon Jul 06 16:17:09 2020 +0200 +++ b/Framework/ImageToolbox.cpp Mon Jul 06 16:29:41 2020 +0200 @@ -25,6 +25,7 @@ #include "Jpeg2000Reader.h" #include "Jpeg2000Writer.h" +#include <Compatibility.h> // For std::unique_ptr #include <OrthancException.h> #include <Images/ImageProcessing.h> #include <Images/PngReader.h> @@ -133,21 +134,21 @@ { case ImageCompression_Png: { - std::auto_ptr<Orthanc::PngReader> reader(new Orthanc::PngReader); + std::unique_ptr<Orthanc::PngReader> reader(new Orthanc::PngReader); reader->ReadFromMemory(source); return reader.release(); } case ImageCompression_Jpeg: { - std::auto_ptr<Orthanc::JpegReader> reader(new Orthanc::JpegReader); + std::unique_ptr<Orthanc::JpegReader> reader(new Orthanc::JpegReader); reader->ReadFromMemory(source); return reader.release(); } case ImageCompression_Jpeg2000: { - std::auto_ptr<Jpeg2000Reader> reader(new Jpeg2000Reader); + std::unique_ptr<Jpeg2000Reader> reader(new Jpeg2000Reader); reader->ReadFromMemory(source); return reader.release(); } @@ -194,7 +195,7 @@ } else { - std::auto_ptr<Orthanc::IImageWriter> writer; + std::unique_ptr<Orthanc::IImageWriter> writer; switch (compression) { @@ -232,7 +233,7 @@ } else { - std::auto_ptr<Orthanc::ImageAccessor> decoded(DecodeTile(source, sourceCompression)); + std::unique_ptr<Orthanc::ImageAccessor> decoded(DecodeTile(source, sourceCompression)); EncodeTile(target, *decoded, targetCompression, quality); } } @@ -328,7 +329,7 @@ const unsigned int bytesPerPixel = source.GetBytesPerPixel(); // Corresponds to the number of channels tx (*) - std::auto_ptr<Orthanc::ImageAccessor> target(Allocate(source.GetFormat(), + std::unique_ptr<Orthanc::ImageAccessor> target(Allocate(source.GetFormat(), source.GetWidth() / 2, source.GetHeight() / 2)); @@ -358,7 +359,7 @@ Orthanc::ImageAccessor* Clone(const Orthanc::ImageAccessor& accessor) { - std::auto_ptr<Orthanc::ImageAccessor> result(Allocate(accessor.GetFormat(), + std::unique_ptr<Orthanc::ImageAccessor> result(Allocate(accessor.GetFormat(), accessor.GetWidth(), accessor.GetHeight())); Embed(*result, accessor, 0, 0); @@ -370,7 +371,7 @@ Orthanc::ImageAccessor* Render(ITiledPyramid& pyramid, unsigned int level) { - std::auto_ptr<Orthanc::ImageAccessor> result(Allocate(pyramid.GetPixelFormat(), + std::unique_ptr<Orthanc::ImageAccessor> result(Allocate(pyramid.GetPixelFormat(), pyramid.GetLevelWidth(level), pyramid.GetLevelHeight(level))); @@ -380,7 +381,7 @@ { for (unsigned int x = 0; x < result->GetWidth(); x += pyramid.GetTileWidth()) { - std::auto_ptr<Orthanc::ImageAccessor> tile(pyramid.DecodeTile(level, + std::unique_ptr<Orthanc::ImageAccessor> tile(pyramid.DecodeTile(level, x / pyramid.GetTileWidth(), y / pyramid.GetTileHeight())); Embed(*result, *tile, x, y);
--- a/Framework/Inputs/DecodedTiledPyramid.cpp Mon Jul 06 16:17:09 2020 +0200 +++ b/Framework/Inputs/DecodedTiledPyramid.cpp Mon Jul 06 16:29:41 2020 +0200 @@ -24,6 +24,8 @@ #include "../ImageToolbox.h" +#include <Compatibility.h> // For std::unique_ptr + #include <memory> #include <cassert> @@ -62,7 +64,7 @@ unsigned int x = tileX * GetTileWidth(); unsigned int y = tileY * GetTileHeight(); - std::auto_ptr<Orthanc::ImageAccessor> tile + std::unique_ptr<Orthanc::ImageAccessor> tile (ImageToolbox::Allocate(GetPixelFormat(), GetTileWidth(), GetTileHeight())); if (x >= GetLevelWidth(level) || @@ -105,7 +107,7 @@ else { // The tile exceeds the size of image, decode it to a temporary buffer - std::auto_ptr<Orthanc::ImageAccessor> cropped + std::unique_ptr<Orthanc::ImageAccessor> cropped (ImageToolbox::Allocate(GetPixelFormat(), regionWidth, regionHeight)); ReadRegion(*cropped, level, x, y);
--- a/Framework/Inputs/OpenSlideLibrary.cpp Mon Jul 06 16:17:09 2020 +0200 +++ b/Framework/Inputs/OpenSlideLibrary.cpp Mon Jul 06 16:29:41 2020 +0200 @@ -22,6 +22,7 @@ #include "../PrecompiledHeadersWSI.h" #include "OpenSlideLibrary.h" +#include <Compatibility.h> // For std::unique_ptr #include <Logging.h> #include <Images/Image.h> #include <OrthancException.h> @@ -30,7 +31,7 @@ namespace OrthancWSI { - static std::auto_ptr<OpenSlideLibrary> globalLibrary_; + static std::unique_ptr<OpenSlideLibrary> globalLibrary_; OpenSlideLibrary::OpenSlideLibrary(const std::string& path) : @@ -194,7 +195,7 @@ CheckLevel(level); // Create a new image, with minimal pitch so as to be compatible with OpenSlide API - std::auto_ptr<Orthanc::ImageAccessor> region(new Orthanc::Image(Orthanc::PixelFormat_BGRA32, width, height, true)); + std::unique_ptr<Orthanc::ImageAccessor> region(new Orthanc::Image(Orthanc::PixelFormat_BGRA32, width, height, true)); if (region->GetWidth() != 0 && region->GetHeight() != 0)
--- a/Framework/Inputs/OpenSlidePyramid.cpp Mon Jul 06 16:17:09 2020 +0200 +++ b/Framework/Inputs/OpenSlidePyramid.cpp Mon Jul 06 16:29:41 2020 +0200 @@ -22,6 +22,7 @@ #include "../PrecompiledHeadersWSI.h" #include "OpenSlidePyramid.h" +#include <Compatibility.h> // For std::unique_ptr #include <Images/ImageProcessing.h> #include <OrthancException.h> #include <Logging.h> @@ -35,7 +36,7 @@ unsigned int x, unsigned int y) { - std::auto_ptr<Orthanc::ImageAccessor> source(image_.ReadRegion(level, x, y, target.GetWidth(), target.GetHeight())); + std::unique_ptr<Orthanc::ImageAccessor> source(image_.ReadRegion(level, x, y, target.GetWidth(), target.GetHeight())); Orthanc::ImageProcessing::Convert(target, *source); }
--- a/Framework/Jpeg2000Reader.cpp Mon Jul 06 16:17:09 2020 +0200 +++ b/Framework/Jpeg2000Reader.cpp Mon Jul 06 16:29:41 2020 +0200 @@ -22,9 +22,11 @@ #include "PrecompiledHeadersWSI.h" #include "Jpeg2000Reader.h" +#include "ImageToolbox.h" + +#include <Compatibility.h> // For std::unique_ptr #include <OrthancException.h> #include <SystemToolbox.h> -#include "ImageToolbox.h" #include <cassert> #include <string.h> @@ -400,7 +402,7 @@ throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented); } - std::auto_ptr<Orthanc::ImageAccessor> image(ImageToolbox::Allocate(format, width, height)); + std::unique_ptr<Orthanc::ImageAccessor> image(ImageToolbox::Allocate(format, width, height)); switch (format) {
--- a/Framework/Jpeg2000Reader.h Mon Jul 06 16:17:09 2020 +0200 +++ b/Framework/Jpeg2000Reader.h Mon Jul 06 16:29:41 2020 +0200 @@ -21,7 +21,9 @@ #pragma once +#include <Compatibility.h> // For std::unique_ptr #include <Images/Image.h> + #include <memory> namespace OrthancWSI @@ -36,7 +38,7 @@ class Jpeg2000Reader : public Orthanc::ImageAccessor { private: - std::auto_ptr<Orthanc::ImageAccessor> image_; + std::unique_ptr<Orthanc::ImageAccessor> image_; public: void ReadFromFile(const std::string& filename);
--- a/Framework/MultiThreading/BagOfTasksProcessor.cpp Mon Jul 06 16:17:09 2020 +0200 +++ b/Framework/MultiThreading/BagOfTasksProcessor.cpp Mon Jul 06 16:29:41 2020 +0200 @@ -21,6 +21,7 @@ #include "BagOfTasksProcessor.h" +#include <Compatibility.h> // For std::unique_ptr #include <Logging.h> #include <OrthancException.h> @@ -32,7 +33,7 @@ { private: uint64_t bag_; - std::auto_ptr<ICommand> command_; + std::unique_ptr<ICommand> command_; public: Task(uint64_t bag, @@ -90,7 +91,7 @@ { while (that->continue_) { - std::auto_ptr<IDynamicObject> obj(that->queue_.Dequeue(100)); + std::unique_ptr<IDynamicObject> obj(that->queue_.Dequeue(100)); if (obj.get() != NULL) { Task& task = *dynamic_cast<Task*>(obj.get());
--- a/Framework/Outputs/DicomPyramidWriter.cpp Mon Jul 06 16:17:09 2020 +0200 +++ b/Framework/Outputs/DicomPyramidWriter.cpp Mon Jul 06 16:29:41 2020 +0200 @@ -24,6 +24,7 @@ #include "../DicomToolbox.h" +#include <Compatibility.h> // For std::unique_ptr #include <Logging.h> #include <OrthancException.h> #include <DicomParsing/FromDcmtkBridge.h> @@ -67,7 +68,7 @@ std::string index = (boost::lexical_cast<std::string>(x / GetTileWidth() + 1) + "\\" + boost::lexical_cast<std::string>(y / GetTileHeight() + 1)); - std::auto_ptr<DcmItem> dimension(new DcmItem); + std::unique_ptr<DcmItem> dimension(new DcmItem); if (!dimension->putAndInsertString(DCM_DimensionIndexValues, index.c_str()).good()) { throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError); @@ -76,7 +77,7 @@ // From Supp 145: The column position of the top left pixel of the // Total Pixel Matrix is 1. The row position of the top left pixel // of the Total Pixel Matrix is 1. - std::auto_ptr<DcmItem> position(new DcmItem); + std::unique_ptr<DcmItem> position(new DcmItem); if (!position->putAndInsertSint32(DCM_ColumnPositionInTotalImagePixelMatrix, x + 1).good() || !position->putAndInsertSint32(DCM_RowPositionInTotalImagePixelMatrix, y + 1).good() || !position->putAndInsertString(DCM_XOffsetInSlideCoordinateSystem, tmpX.c_str()).good() || @@ -87,19 +88,19 @@ } - std::auto_ptr<DcmSequenceOfItems> sequencePosition(new DcmSequenceOfItems(DCM_PlanePositionSlideSequence)); + std::unique_ptr<DcmSequenceOfItems> sequencePosition(new DcmSequenceOfItems(DCM_PlanePositionSlideSequence)); if (!sequencePosition->insert(position.release(), false, false).good()) { throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError); } - std::auto_ptr<DcmSequenceOfItems> sequenceDimension(new DcmSequenceOfItems(DCM_FrameContentSequence)); + std::unique_ptr<DcmSequenceOfItems> sequenceDimension(new DcmSequenceOfItems(DCM_FrameContentSequence)); if (!sequenceDimension->insert(dimension.release(), false, false).good()) { throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError); } - std::auto_ptr<DcmItem> item(new DcmItem); + std::unique_ptr<DcmItem> item(new DcmItem); if (!item->insert(sequencePosition.release(), false, false).good() || !item->insert(sequenceDimension.release(), false, false).good()) { @@ -153,14 +154,14 @@ std::string spacing = (boost::lexical_cast<std::string>(spacingX) + '\\' + boost::lexical_cast<std::string>(spacingY)); - std::auto_ptr<DcmItem> item(new DcmItem); + std::unique_ptr<DcmItem> item(new DcmItem); - std::auto_ptr<DcmItem> item2(new DcmItem); + std::unique_ptr<DcmItem> item2(new DcmItem); OrthancWSI::DicomToolbox::SetStringTag(*item2, DCM_SliceThickness, boost::lexical_cast<std::string>(volume_.GetDepth())); OrthancWSI::DicomToolbox::SetStringTag(*item2, DCM_PixelSpacing, spacing); - std::auto_ptr<DcmSequenceOfItems> sequence2(new DcmSequenceOfItems(DCM_PixelMeasuresSequence)); + std::unique_ptr<DcmSequenceOfItems> sequence2(new DcmSequenceOfItems(DCM_PixelMeasuresSequence)); if (!sequence2->insert(item2.release(), false, false).good()) { throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError); @@ -179,7 +180,7 @@ } } - std::auto_ptr<DcmItem> functionalGroup(CreateFunctionalGroup(writer->GetFramesCount() + 1, + std::unique_ptr<DcmItem> functionalGroup(CreateFunctionalGroup(writer->GetFramesCount() + 1, x * GetTileWidth(), y * GetTileHeight(), writer->GetTotalWidth(),
--- a/Framework/Outputs/InMemoryTiledImage.cpp Mon Jul 06 16:17:09 2020 +0200 +++ b/Framework/Outputs/InMemoryTiledImage.cpp Mon Jul 06 16:29:41 2020 +0200 @@ -23,6 +23,8 @@ #include "InMemoryTiledImage.h" #include "../ImageToolbox.h" + +#include <Compatibility.h> // For std::unique_ptr #include <Logging.h> #include <OrthancException.h> @@ -119,7 +121,7 @@ Tiles::const_iterator it = tiles_.find(std::make_pair(tileX, tileY)); if (it != tiles_.end()) { - std::auto_ptr<Orthanc::ImageAccessor> result(new Orthanc::ImageAccessor); + std::unique_ptr<Orthanc::ImageAccessor> result(new Orthanc::ImageAccessor); it->second->GetReadOnlyAccessor(*result); return result.release(); } @@ -138,7 +140,7 @@ unsigned int tileX, unsigned int tileY) { - std::auto_ptr<Orthanc::ImageAccessor> decoded(ImageToolbox::DecodeTile(raw, compression)); + std::unique_ptr<Orthanc::ImageAccessor> decoded(ImageToolbox::DecodeTile(raw, compression)); EncodeTile(*decoded, level, tileX, tileY); }
--- a/Framework/Outputs/MultiframeDicomWriter.cpp Mon Jul 06 16:17:09 2020 +0200 +++ b/Framework/Outputs/MultiframeDicomWriter.cpp Mon Jul 06 16:29:41 2020 +0200 @@ -22,9 +22,11 @@ #include "../PrecompiledHeadersWSI.h" #include "MultiframeDicomWriter.h" +#include "../DicomToolbox.h" + +#include <Compatibility.h> // For std::unique_ptr #include <OrthancException.h> #include <Logging.h> -#include "../DicomToolbox.h" #include <dcmtk/dcmdata/dcuid.h> #include <dcmtk/dcmdata/dcdeftag.h> @@ -115,7 +117,7 @@ throw Orthanc::OrthancException(Orthanc::ErrorCode_NotEnoughMemory); } - std::auto_ptr<DcmPixelData> pixels(new DcmPixelData(DCM_PixelData)); + std::unique_ptr<DcmPixelData> pixels(new DcmPixelData(DCM_PixelData)); uint8_t* target = NULL; if (!pixels->createUint8Array(pixelData.size(), target).good()) @@ -214,7 +216,7 @@ DcmItem* functionalGroup) // This takes the ownership { // Free the functional group on error - std::auto_ptr<DcmItem> functionalGroupRaii(functionalGroup); + std::unique_ptr<DcmItem> functionalGroupRaii(functionalGroup); if (compression_ == ImageCompression_None) { @@ -259,7 +261,7 @@ std::string tmp = boost::lexical_cast<std::string>(instanceNumber); - std::auto_ptr<DcmFileFormat> dicom(new DcmFileFormat); + std::unique_ptr<DcmFileFormat> dicom(new DcmFileFormat); char uid[100]; dcmGenerateUniqueIdentifier(uid, SITE_INSTANCE_UID_ROOT);
--- a/Framework/Outputs/MultiframeDicomWriter.h Mon Jul 06 16:17:09 2020 +0200 +++ b/Framework/Outputs/MultiframeDicomWriter.h Mon Jul 06 16:29:41 2020 +0200 @@ -22,6 +22,8 @@ #pragma once #include "../Enumerations.h" + +#include <Compatibility.h> // For std::unique_ptr #include <ChunkedBuffer.h> #include <boost/noncopyable.hpp> @@ -47,10 +49,10 @@ unsigned int height_; Orthanc::ChunkedBuffer uncompressedPixelData_; - std::auto_ptr<DcmSequenceOfItems> perFrameFunctionalGroups_; - std::auto_ptr<DcmPixelSequence> compressedPixelSequence_; + std::unique_ptr<DcmSequenceOfItems> perFrameFunctionalGroups_; + std::unique_ptr<DcmPixelSequence> compressedPixelSequence_; DcmPixelItem* offsetTable_; - std::auto_ptr<DcmOffsetList> offsetList_; + std::unique_ptr<DcmOffsetList> offsetList_; void ResetImage();
--- a/Framework/Targets/OrthancTarget.h Mon Jul 06 16:17:09 2020 +0200 +++ b/Framework/Targets/OrthancTarget.h Mon Jul 06 16:29:41 2020 +0200 @@ -24,6 +24,7 @@ #include "IFileTarget.h" #include "../../Resources/Orthanc/Stone/IOrthancConnection.h" +#include <Compatibility.h> // For std::unique_ptr #include <WebServiceParameters.h> #include <memory> @@ -33,7 +34,7 @@ class OrthancTarget : public IFileTarget { private: - std::auto_ptr<OrthancStone::IOrthancConnection> orthanc_; + std::unique_ptr<OrthancStone::IOrthancConnection> orthanc_; bool first_; public:
--- a/ViewerPlugin/DicomPyramidCache.cpp Mon Jul 06 16:17:09 2020 +0200 +++ b/ViewerPlugin/DicomPyramidCache.cpp Mon Jul 06 16:29:41 2020 +0200 @@ -22,6 +22,8 @@ #include "../Framework/PrecompiledHeadersWSI.h" #include "DicomPyramidCache.h" +#include <Compatibility.h> // For std::unique_ptr + #include <cassert> namespace OrthancWSI @@ -64,7 +66,7 @@ // time-consuming operation, we don't want it to block other clients) lock.unlock(); - std::auto_ptr<DicomPyramid> pyramid + std::unique_ptr<DicomPyramid> pyramid (new DicomPyramid(orthanc_, seriesId, true /* use metadata cache */)); { @@ -138,7 +140,7 @@ if (cache_.Contains(seriesId)) { - std::auto_ptr<DicomPyramid> pyramid(cache_.Invalidate(seriesId)); + std::unique_ptr<DicomPyramid> pyramid(cache_.Invalidate(seriesId)); if (pyramid.get() == NULL) {
--- a/ViewerPlugin/Plugin.cpp Mon Jul 06 16:17:09 2020 +0200 +++ b/ViewerPlugin/Plugin.cpp Mon Jul 06 16:29:41 2020 +0200 @@ -25,6 +25,7 @@ #include "DicomPyramidCache.h" #include "OrthancPluginConnection.h" +#include <Compatibility.h> // For std::unique_ptr #include <Logging.h> #include <Images/ImageProcessing.h> #include <Images/PngWriter.h> @@ -38,9 +39,9 @@ #include <cassert> -std::auto_ptr<OrthancWSI::OrthancPluginConnection> orthanc_; -std::auto_ptr<OrthancWSI::DicomPyramidCache> cache_; -std::auto_ptr<Orthanc::Semaphore> transcoderSemaphore_; +std::unique_ptr<OrthancWSI::OrthancPluginConnection> orthanc_; +std::unique_ptr<OrthancWSI::DicomPyramidCache> cache_; +std::unique_ptr<Orthanc::Semaphore> transcoderSemaphore_; static void AnswerSparseTile(OrthancPluginRestOutput* output, @@ -183,7 +184,7 @@ // The tile does not come from a DICOM-JPEG instance, we need to // decompress the raw tile - std::auto_ptr<Orthanc::ImageAccessor> decoded; + std::unique_ptr<Orthanc::ImageAccessor> decoded; Orthanc::Semaphore::Locker locker(*transcoderSemaphore_);