# HG changeset patch # User Sebastien Jodogne # Date 1594045781 -7200 # Node ID a1c265cb21749f2b788e254cb62fcc8e75c9465f # Parent 2d3fe69678941a5d96f1d1100bf78612eb579d1d replacing deprecated std::auto_ptr by std::unique_ptr diff -r 2d3fe6967894 -r a1c265cb2174 Applications/ApplicationToolbox.cpp --- 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 // For std::unique_ptr #include #include #include @@ -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 handle(processor.Submit(tasks)); + std::unique_ptr 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 task(tasks.Pop()); + std::unique_ptr task(tasks.Pop()); if (task->Execute()) { unsigned int progress = static_cast(100.0f * diff -r 2d3fe6967894 -r a1c265cb2174 Applications/DicomToTiff.cpp --- 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 // For std::unique_ptr #include #include @@ -159,7 +160,7 @@ static Orthanc::ImageAccessor* CreateEmptyTile(const OrthancWSI::IPyramidWriter& writer, const boost::program_options::variables_map& options) { - std::auto_ptr tile + std::unique_ptr 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 empty(CreateEmptyTile(target, options)); + std::unique_ptr empty(CreateEmptyTile(target, options)); for (unsigned int level = 0; level < source.GetLevelCount(); level++) { @@ -254,7 +255,7 @@ } else if (reencode) { - std::auto_ptr decoded; + std::unique_ptr decoded; if (compression == OrthancWSI::ImageCompression_None) { diff -r 2d3fe6967894 -r a1c265cb2174 Applications/Dicomizer.cpp --- 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 // For std::unique_ptr #include #include #include @@ -300,7 +301,7 @@ } } - std::auto_ptr dataset(Orthanc::FromDcmtkBridge::FromJson(json, true, true, Orthanc::Encoding_Latin1, + std::unique_ptr 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 item(new DcmItem); + std::unique_ptr item(new DcmItem); OrthancWSI::DicomToolbox::SetStringTag(*item, DCM_DimensionOrganizationUID, organization); - std::auto_ptr sequence(new DcmSequenceOfItems(DCM_DimensionOrganizationSequence)); + std::unique_ptr 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 item(new DcmItem); + std::unique_ptr 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 item2(new DcmItem); + std::unique_ptr 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 sequence(new DcmSequenceOfItems(DCM_DimensionIndexSequence)); + std::unique_ptr 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 item(new DcmItem); + std::unique_ptr item(new DcmItem); - std::auto_ptr item3(new DcmItem); + std::unique_ptr item3(new DcmItem); OrthancWSI::DicomToolbox::SetStringTag(*item3, DCM_OpticalPathIdentifier, opticalPathId); - std::auto_ptr sequence(new DcmSequenceOfItems(DCM_SharedFunctionalGroupsSequence)); - std::auto_ptr sequence3(new DcmSequenceOfItems(DCM_OpticalPathIdentificationSequence)); + std::unique_ptr sequence(new DcmSequenceOfItems(DCM_SharedFunctionalGroupsSequence)); + std::unique_ptr 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(volume.GetHeight())); OrthancWSI::DicomToolbox::SetStringTag(dataset, DCM_ImagedVolumeDepth, boost::lexical_cast(volume.GetDepth())); - std::auto_ptr origin(new DcmItem); + std::unique_ptr origin(new DcmItem); OrthancWSI::DicomToolbox::SetStringTag(*origin, DCM_XOffsetInSlideCoordinateSystem, boost::lexical_cast(volume.GetOffsetX())); OrthancWSI::DicomToolbox::SetStringTag(*origin, DCM_YOffsetInSlideCoordinateSystem, boost::lexical_cast(volume.GetOffsetY())); - std::auto_ptr sequenceOrigin(new DcmSequenceOfItems(DCM_TotalPixelMatrixOriginSequence)); + std::unique_ptr 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 element(Orthanc::FromDcmtkBridge::FromJson( + std::unique_ptr 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 icc(new DcmOtherByteOtherWord(DCM_ICCProfile)); + std::unique_ptr icc(new DcmOtherByteOtherWord(DCM_ICCProfile)); if (!icc->putUint8Array(reinterpret_cast(profile.c_str()), profile.size()).good() || !opticalPath->insert(icc.release()).good()) @@ -927,7 +928,7 @@ { try { - std::auto_ptr tiff(new OrthancWSI::HierarchicalTiff(path)); + std::unique_ptr 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 source; + std::unique_ptr 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 dataset(ParseDataset(parameters.GetDatasetPath())); + std::unique_ptr dataset(ParseDataset(parameters.GetDatasetPath())); EnrichDataset(*dataset, *source, sourceCompression, parameters, volume); - std::auto_ptr output(parameters.CreateTarget()); + std::unique_ptr output(parameters.CreateTarget()); Recompress(*output, *source, *dataset, parameters, volume, sourceCompression); } } diff -r 2d3fe6967894 -r a1c265cb2174 Framework/Algorithms/PyramidReader.cpp --- 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 // For std::unique_ptr #include #include @@ -40,7 +42,7 @@ std::string rawTile_; ImageCompression rawTileCompression_; - std::auto_ptr decoded_; + std::unique_ptr decoded_; bool IsRepaintNeeded() const { @@ -197,7 +199,7 @@ { if (parameters_.IsSafetyCheck()) { - std::auto_ptr decoded(ImageToolbox::DecodeTile(tile, compression)); + std::unique_ptr decoded(ImageToolbox::DecodeTile(tile, compression)); CheckTileSize(*decoded); } } diff -r 2d3fe6967894 -r a1c265cb2174 Framework/Algorithms/PyramidReader.h --- 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 // For std::unique_ptr + #include #include @@ -50,7 +52,7 @@ Cache cache_; - std::auto_ptr outside_; + std::unique_ptr outside_; Orthanc::ImageAccessor& GetOutsideTile(); diff -r 2d3fe6967894 -r a1c265cb2174 Framework/Algorithms/ReconstructPyramidCommand.cpp --- 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 // For std::unique_ptr #include #include #include @@ -46,7 +48,7 @@ return NULL; } - std::auto_ptr result; + std::unique_ptr result; if (level == 0) { @@ -69,7 +71,7 @@ } else { - std::auto_ptr mosaic(ImageToolbox::Allocate(source_.GetPixelFormat(), + std::unique_ptr mosaic(ImageToolbox::Allocate(source_.GetPixelFormat(), 2 * target_.GetTileWidth(), 2 * target_.GetTileHeight())); ImageToolbox::Set(*mosaic, @@ -78,7 +80,7 @@ source_.GetParameters().GetBackgroundColorBlue()); { - std::auto_ptr subTile(Explore(level - 1, 2 * offsetX, 2 * offsetY)); + std::unique_ptr 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 subTile(Explore(level - 1, 2 * offsetX + 1, 2 * offsetY)); + std::unique_ptr 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 subTile(Explore(level - 1, 2 * offsetX, 2 * offsetY + 1)); + std::unique_ptr 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 subTile(Explore(level - 1, 2 * offsetX + 1, 2 * offsetY + 1)); + std::unique_ptr 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 root(Explore(upToLevel_, 0, 0)); + std::unique_ptr root(Explore(upToLevel_, 0, 0)); return true; } @@ -177,7 +179,7 @@ { for (unsigned int x = 0; x < targetCountTilesX; x += step) { - std::auto_ptr command; + std::unique_ptr command; command.reset(new ReconstructPyramidCommand (target, source, countLevels - 1, x, y, parameters)); command->SetShiftTargetLevel(shiftTargetLevel); diff -r 2d3fe6967894 -r a1c265cb2174 Framework/DicomToolbox.cpp --- 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 // For std::unique_ptr #include #include #include @@ -79,7 +80,7 @@ { if (!dataset.tagExists(key)) { - std::auto_ptr tag(new DcmAttributeTag(key)); + std::unique_ptr tag(new DcmAttributeTag(key)); if (!tag->putTagVal(value).good() || !dataset.insert(tag.release()).good()) diff -r 2d3fe6967894 -r a1c265cb2174 Framework/ImageToolbox.cpp --- 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 // For std::unique_ptr #include #include #include @@ -133,21 +134,21 @@ { case ImageCompression_Png: { - std::auto_ptr reader(new Orthanc::PngReader); + std::unique_ptr reader(new Orthanc::PngReader); reader->ReadFromMemory(source); return reader.release(); } case ImageCompression_Jpeg: { - std::auto_ptr reader(new Orthanc::JpegReader); + std::unique_ptr reader(new Orthanc::JpegReader); reader->ReadFromMemory(source); return reader.release(); } case ImageCompression_Jpeg2000: { - std::auto_ptr reader(new Jpeg2000Reader); + std::unique_ptr reader(new Jpeg2000Reader); reader->ReadFromMemory(source); return reader.release(); } @@ -194,7 +195,7 @@ } else { - std::auto_ptr writer; + std::unique_ptr writer; switch (compression) { @@ -232,7 +233,7 @@ } else { - std::auto_ptr decoded(DecodeTile(source, sourceCompression)); + std::unique_ptr 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 target(Allocate(source.GetFormat(), + std::unique_ptr target(Allocate(source.GetFormat(), source.GetWidth() / 2, source.GetHeight() / 2)); @@ -358,7 +359,7 @@ Orthanc::ImageAccessor* Clone(const Orthanc::ImageAccessor& accessor) { - std::auto_ptr result(Allocate(accessor.GetFormat(), + std::unique_ptr 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 result(Allocate(pyramid.GetPixelFormat(), + std::unique_ptr 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 tile(pyramid.DecodeTile(level, + std::unique_ptr tile(pyramid.DecodeTile(level, x / pyramid.GetTileWidth(), y / pyramid.GetTileHeight())); Embed(*result, *tile, x, y); diff -r 2d3fe6967894 -r a1c265cb2174 Framework/Inputs/DecodedTiledPyramid.cpp --- 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 // For std::unique_ptr + #include #include @@ -62,7 +64,7 @@ unsigned int x = tileX * GetTileWidth(); unsigned int y = tileY * GetTileHeight(); - std::auto_ptr tile + std::unique_ptr 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 cropped + std::unique_ptr cropped (ImageToolbox::Allocate(GetPixelFormat(), regionWidth, regionHeight)); ReadRegion(*cropped, level, x, y); diff -r 2d3fe6967894 -r a1c265cb2174 Framework/Inputs/OpenSlideLibrary.cpp --- 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 // For std::unique_ptr #include #include #include @@ -30,7 +31,7 @@ namespace OrthancWSI { - static std::auto_ptr globalLibrary_; + static std::unique_ptr 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 region(new Orthanc::Image(Orthanc::PixelFormat_BGRA32, width, height, true)); + std::unique_ptr region(new Orthanc::Image(Orthanc::PixelFormat_BGRA32, width, height, true)); if (region->GetWidth() != 0 && region->GetHeight() != 0) diff -r 2d3fe6967894 -r a1c265cb2174 Framework/Inputs/OpenSlidePyramid.cpp --- 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 // For std::unique_ptr #include #include #include @@ -35,7 +36,7 @@ unsigned int x, unsigned int y) { - std::auto_ptr source(image_.ReadRegion(level, x, y, target.GetWidth(), target.GetHeight())); + std::unique_ptr source(image_.ReadRegion(level, x, y, target.GetWidth(), target.GetHeight())); Orthanc::ImageProcessing::Convert(target, *source); } diff -r 2d3fe6967894 -r a1c265cb2174 Framework/Jpeg2000Reader.cpp --- 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 // For std::unique_ptr #include #include -#include "ImageToolbox.h" #include #include @@ -400,7 +402,7 @@ throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented); } - std::auto_ptr image(ImageToolbox::Allocate(format, width, height)); + std::unique_ptr image(ImageToolbox::Allocate(format, width, height)); switch (format) { diff -r 2d3fe6967894 -r a1c265cb2174 Framework/Jpeg2000Reader.h --- 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 // For std::unique_ptr #include + #include namespace OrthancWSI @@ -36,7 +38,7 @@ class Jpeg2000Reader : public Orthanc::ImageAccessor { private: - std::auto_ptr image_; + std::unique_ptr image_; public: void ReadFromFile(const std::string& filename); diff -r 2d3fe6967894 -r a1c265cb2174 Framework/MultiThreading/BagOfTasksProcessor.cpp --- 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 // For std::unique_ptr #include #include @@ -32,7 +33,7 @@ { private: uint64_t bag_; - std::auto_ptr command_; + std::unique_ptr command_; public: Task(uint64_t bag, @@ -90,7 +91,7 @@ { while (that->continue_) { - std::auto_ptr obj(that->queue_.Dequeue(100)); + std::unique_ptr obj(that->queue_.Dequeue(100)); if (obj.get() != NULL) { Task& task = *dynamic_cast(obj.get()); diff -r 2d3fe6967894 -r a1c265cb2174 Framework/Outputs/DicomPyramidWriter.cpp --- 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 // For std::unique_ptr #include #include #include @@ -67,7 +68,7 @@ std::string index = (boost::lexical_cast(x / GetTileWidth() + 1) + "\\" + boost::lexical_cast(y / GetTileHeight() + 1)); - std::auto_ptr dimension(new DcmItem); + std::unique_ptr 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 position(new DcmItem); + std::unique_ptr 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 sequencePosition(new DcmSequenceOfItems(DCM_PlanePositionSlideSequence)); + std::unique_ptr sequencePosition(new DcmSequenceOfItems(DCM_PlanePositionSlideSequence)); if (!sequencePosition->insert(position.release(), false, false).good()) { throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError); } - std::auto_ptr sequenceDimension(new DcmSequenceOfItems(DCM_FrameContentSequence)); + std::unique_ptr sequenceDimension(new DcmSequenceOfItems(DCM_FrameContentSequence)); if (!sequenceDimension->insert(dimension.release(), false, false).good()) { throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError); } - std::auto_ptr item(new DcmItem); + std::unique_ptr 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(spacingX) + '\\' + boost::lexical_cast(spacingY)); - std::auto_ptr item(new DcmItem); + std::unique_ptr item(new DcmItem); - std::auto_ptr item2(new DcmItem); + std::unique_ptr item2(new DcmItem); OrthancWSI::DicomToolbox::SetStringTag(*item2, DCM_SliceThickness, boost::lexical_cast(volume_.GetDepth())); OrthancWSI::DicomToolbox::SetStringTag(*item2, DCM_PixelSpacing, spacing); - std::auto_ptr sequence2(new DcmSequenceOfItems(DCM_PixelMeasuresSequence)); + std::unique_ptr 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 functionalGroup(CreateFunctionalGroup(writer->GetFramesCount() + 1, + std::unique_ptr functionalGroup(CreateFunctionalGroup(writer->GetFramesCount() + 1, x * GetTileWidth(), y * GetTileHeight(), writer->GetTotalWidth(), diff -r 2d3fe6967894 -r a1c265cb2174 Framework/Outputs/InMemoryTiledImage.cpp --- 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 // For std::unique_ptr #include #include @@ -119,7 +121,7 @@ Tiles::const_iterator it = tiles_.find(std::make_pair(tileX, tileY)); if (it != tiles_.end()) { - std::auto_ptr result(new Orthanc::ImageAccessor); + std::unique_ptr result(new Orthanc::ImageAccessor); it->second->GetReadOnlyAccessor(*result); return result.release(); } @@ -138,7 +140,7 @@ unsigned int tileX, unsigned int tileY) { - std::auto_ptr decoded(ImageToolbox::DecodeTile(raw, compression)); + std::unique_ptr decoded(ImageToolbox::DecodeTile(raw, compression)); EncodeTile(*decoded, level, tileX, tileY); } diff -r 2d3fe6967894 -r a1c265cb2174 Framework/Outputs/MultiframeDicomWriter.cpp --- 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 // For std::unique_ptr #include #include -#include "../DicomToolbox.h" #include #include @@ -115,7 +117,7 @@ throw Orthanc::OrthancException(Orthanc::ErrorCode_NotEnoughMemory); } - std::auto_ptr pixels(new DcmPixelData(DCM_PixelData)); + std::unique_ptr 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 functionalGroupRaii(functionalGroup); + std::unique_ptr functionalGroupRaii(functionalGroup); if (compression_ == ImageCompression_None) { @@ -259,7 +261,7 @@ std::string tmp = boost::lexical_cast(instanceNumber); - std::auto_ptr dicom(new DcmFileFormat); + std::unique_ptr dicom(new DcmFileFormat); char uid[100]; dcmGenerateUniqueIdentifier(uid, SITE_INSTANCE_UID_ROOT); diff -r 2d3fe6967894 -r a1c265cb2174 Framework/Outputs/MultiframeDicomWriter.h --- 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 // For std::unique_ptr #include #include @@ -47,10 +49,10 @@ unsigned int height_; Orthanc::ChunkedBuffer uncompressedPixelData_; - std::auto_ptr perFrameFunctionalGroups_; - std::auto_ptr compressedPixelSequence_; + std::unique_ptr perFrameFunctionalGroups_; + std::unique_ptr compressedPixelSequence_; DcmPixelItem* offsetTable_; - std::auto_ptr offsetList_; + std::unique_ptr offsetList_; void ResetImage(); diff -r 2d3fe6967894 -r a1c265cb2174 Framework/Targets/OrthancTarget.h --- 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 // For std::unique_ptr #include #include @@ -33,7 +34,7 @@ class OrthancTarget : public IFileTarget { private: - std::auto_ptr orthanc_; + std::unique_ptr orthanc_; bool first_; public: diff -r 2d3fe6967894 -r a1c265cb2174 ViewerPlugin/DicomPyramidCache.cpp --- 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 // For std::unique_ptr + #include namespace OrthancWSI @@ -64,7 +66,7 @@ // time-consuming operation, we don't want it to block other clients) lock.unlock(); - std::auto_ptr pyramid + std::unique_ptr pyramid (new DicomPyramid(orthanc_, seriesId, true /* use metadata cache */)); { @@ -138,7 +140,7 @@ if (cache_.Contains(seriesId)) { - std::auto_ptr pyramid(cache_.Invalidate(seriesId)); + std::unique_ptr pyramid(cache_.Invalidate(seriesId)); if (pyramid.get() == NULL) { diff -r 2d3fe6967894 -r a1c265cb2174 ViewerPlugin/Plugin.cpp --- 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 // For std::unique_ptr #include #include #include @@ -38,9 +39,9 @@ #include -std::auto_ptr orthanc_; -std::auto_ptr cache_; -std::auto_ptr transcoderSemaphore_; +std::unique_ptr orthanc_; +std::unique_ptr cache_; +std::unique_ptr 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 decoded; + std::unique_ptr decoded; Orthanc::Semaphore::Locker locker(*transcoderSemaphore_);