Mercurial > hg > orthanc-stone
comparison Framework/Radiography/RadiographyScene.cpp @ 1299:c38c89684d83 broker
replacing std::auto_ptr by std::unique_ptr
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 02 Mar 2020 17:21:24 +0100 |
parents | 6ab03e429f06 |
children | 257f2c9a02ac |
comparison
equal
deleted
inserted
replaced
1297:6ab03e429f06 | 1299:c38c89684d83 |
---|---|
125 } | 125 } |
126 } | 126 } |
127 | 127 |
128 void RadiographyScene::_RegisterLayer(RadiographyLayer* layer) | 128 void RadiographyScene::_RegisterLayer(RadiographyLayer* layer) |
129 { | 129 { |
130 std::auto_ptr<RadiographyLayer> raii(layer); | 130 std::unique_ptr<RadiographyLayer> raii(layer); |
131 | 131 |
132 // LOG(INFO) << "Registering layer: " << countLayers_; | 132 // LOG(INFO) << "Registering layer: " << countLayers_; |
133 | 133 |
134 size_t index = nextLayerIndex_++; | 134 size_t index = nextLayerIndex_++; |
135 raii->SetIndex(index); | 135 raii->SetIndex(index); |
322 unsigned int fontSize, | 322 unsigned int fontSize, |
323 uint8_t foreground, | 323 uint8_t foreground, |
324 RadiographyLayer::Geometry* centerGeometry, | 324 RadiographyLayer::Geometry* centerGeometry, |
325 bool isCenterGeometry) | 325 bool isCenterGeometry) |
326 { | 326 { |
327 std::auto_ptr<RadiographyTextLayer> alpha(new RadiographyTextLayer(*this)); | 327 std::unique_ptr<RadiographyTextLayer> alpha(new RadiographyTextLayer(*this)); |
328 alpha->SetText(utf8, font, fontSize, foreground); | 328 alpha->SetText(utf8, font, fontSize, foreground); |
329 if (centerGeometry != NULL) | 329 if (centerGeometry != NULL) |
330 { | 330 { |
331 if (isCenterGeometry) | 331 if (isCenterGeometry) |
332 { | 332 { |
350 | 350 |
351 RadiographyLayer& RadiographyScene::LoadTestBlock(unsigned int width, | 351 RadiographyLayer& RadiographyScene::LoadTestBlock(unsigned int width, |
352 unsigned int height, | 352 unsigned int height, |
353 RadiographyLayer::Geometry* geometry) | 353 RadiographyLayer::Geometry* geometry) |
354 { | 354 { |
355 std::auto_ptr<Orthanc::Image> block(new Orthanc::Image(Orthanc::PixelFormat_Grayscale8, width, height, false)); | 355 std::unique_ptr<Orthanc::Image> block(new Orthanc::Image(Orthanc::PixelFormat_Grayscale8, width, height, false)); |
356 | 356 |
357 for (unsigned int padding = 0; | 357 for (unsigned int padding = 0; |
358 (width > 2 * padding) && (height > 2 * padding); | 358 (width > 2 * padding) && (height > 2 * padding); |
359 padding++) | 359 padding++) |
360 { | 360 { |
379 RadiographyLayer& RadiographyScene::LoadMask(const std::vector<Orthanc::ImageProcessing::ImagePoint>& corners, | 379 RadiographyLayer& RadiographyScene::LoadMask(const std::vector<Orthanc::ImageProcessing::ImagePoint>& corners, |
380 const RadiographyDicomLayer& dicomLayer, | 380 const RadiographyDicomLayer& dicomLayer, |
381 float foreground, | 381 float foreground, |
382 RadiographyLayer::Geometry* geometry) | 382 RadiographyLayer::Geometry* geometry) |
383 { | 383 { |
384 std::auto_ptr<RadiographyMaskLayer> mask(new RadiographyMaskLayer(*this, dicomLayer, foreground)); | 384 std::unique_ptr<RadiographyMaskLayer> mask(new RadiographyMaskLayer(*this, dicomLayer, foreground)); |
385 mask->SetCorners(corners); | 385 mask->SetCorners(corners); |
386 if (geometry != NULL) | 386 if (geometry != NULL) |
387 { | 387 { |
388 mask->SetGeometry(*geometry); | 388 mask->SetGeometry(*geometry); |
389 } | 389 } |
392 } | 392 } |
393 | 393 |
394 | 394 |
395 RadiographyLayer& RadiographyScene::LoadAlphaBitmap(Orthanc::ImageAccessor* bitmap, RadiographyLayer::Geometry *geometry) | 395 RadiographyLayer& RadiographyScene::LoadAlphaBitmap(Orthanc::ImageAccessor* bitmap, RadiographyLayer::Geometry *geometry) |
396 { | 396 { |
397 std::auto_ptr<RadiographyAlphaLayer> alpha(new RadiographyAlphaLayer(*this)); | 397 std::unique_ptr<RadiographyAlphaLayer> alpha(new RadiographyAlphaLayer(*this)); |
398 alpha->SetAlpha(bitmap); | 398 alpha->SetAlpha(bitmap); |
399 if (geometry != NULL) | 399 if (geometry != NULL) |
400 { | 400 { |
401 alpha->SetGeometry(*geometry); | 401 alpha->SetGeometry(*geometry); |
402 } | 402 } |
531 if (message.GetAnswerSize() > 0) | 531 if (message.GetAnswerSize() > 0) |
532 { | 532 { |
533 content.assign(reinterpret_cast<const char*>(message.GetAnswer()), message.GetAnswerSize()); | 533 content.assign(reinterpret_cast<const char*>(message.GetAnswer()), message.GetAnswerSize()); |
534 } | 534 } |
535 | 535 |
536 std::auto_ptr<Orthanc::PamReader> reader(new Orthanc::PamReader); | 536 std::unique_ptr<Orthanc::PamReader> reader(new Orthanc::PamReader); |
537 reader->ReadFromMemory(content); | 537 reader->ReadFromMemory(content); |
538 dynamic_cast<RadiographyDicomLayer*>(layer->second)->SetSourceImage(reader.release()); | 538 dynamic_cast<RadiographyDicomLayer*>(layer->second)->SetSourceImage(reader.release()); |
539 | 539 |
540 BroadcastMessage(ContentChangedMessage(*this, *(layer->second))); | 540 BroadcastMessage(ContentChangedMessage(*this, *(layer->second))); |
541 } | 541 } |
722 Orthanc::ImageProcessing::Set(layers, 0); | 722 Orthanc::ImageProcessing::Set(layers, 0); |
723 } | 723 } |
724 | 724 |
725 Render(layers, view, interpolation, applyWindowing); | 725 Render(layers, view, interpolation, applyWindowing); |
726 | 726 |
727 std::auto_ptr<Orthanc::Image> rendered(new Orthanc::Image(Orthanc::PixelFormat_Grayscale16, | 727 std::unique_ptr<Orthanc::Image> rendered(new Orthanc::Image(Orthanc::PixelFormat_Grayscale16, |
728 layers.GetWidth(), layers.GetHeight(), false)); | 728 layers.GetWidth(), layers.GetHeight(), false)); |
729 | 729 |
730 Orthanc::ImageProcessing::Convert(*rendered, layers); | 730 Orthanc::ImageProcessing::Convert(*rendered, layers); |
731 if (invert) | 731 if (invert) |
732 Orthanc::ImageProcessing::Invert(*rendered, maxValue); | 732 Orthanc::ImageProcessing::Invert(*rendered, maxValue); |
743 bool invert, | 743 bool invert, |
744 ImageInterpolation interpolation) | 744 ImageInterpolation interpolation) |
745 { | 745 { |
746 LOG(INFO) << "Exporting RadiographyScene to DICOM"; | 746 LOG(INFO) << "Exporting RadiographyScene to DICOM"; |
747 | 747 |
748 std::auto_ptr<Orthanc::Image> rendered(ExportToImage(pixelSpacingX, pixelSpacingY, interpolation, false)); // note: we don't invert the image in the pixels data because we'll set the PhotometricDisplayMode correctly in the DICOM tags | 748 std::unique_ptr<Orthanc::Image> rendered(ExportToImage(pixelSpacingX, pixelSpacingY, interpolation, false)); // note: we don't invert the image in the pixels data because we'll set the PhotometricDisplayMode correctly in the DICOM tags |
749 | 749 |
750 createDicomRequestContent["Tags"] = dicomTags; | 750 createDicomRequestContent["Tags"] = dicomTags; |
751 | 751 |
752 RadiographyPhotometricDisplayMode photometricMode = GetPreferredPhotomotricDisplayMode(); | 752 RadiographyPhotometricDisplayMode photometricMode = GetPreferredPhotomotricDisplayMode(); |
753 if ((invert && photometricMode != RadiographyPhotometricDisplayMode_Monochrome2) || | 753 if ((invert && photometricMode != RadiographyPhotometricDisplayMode_Monochrome2) || |
798 bool usePam) | 798 bool usePam) |
799 { | 799 { |
800 LOG(INFO) << "Exporting RadiographyScene to DICOM"; | 800 LOG(INFO) << "Exporting RadiographyScene to DICOM"; |
801 VLOG(1) << "Exporting RadiographyScene to: export to image"; | 801 VLOG(1) << "Exporting RadiographyScene to: export to image"; |
802 | 802 |
803 std::auto_ptr<Orthanc::Image> rendered(ExportToCreateDicomRequestAndImage(createDicomRequestContent, dicomTags, parentOrthancId, pixelSpacingX, pixelSpacingY, invert, interpolation)); | 803 std::unique_ptr<Orthanc::Image> rendered(ExportToCreateDicomRequestAndImage(createDicomRequestContent, dicomTags, parentOrthancId, pixelSpacingX, pixelSpacingY, invert, interpolation)); |
804 | 804 |
805 // convert the image into base64 for inclusing in the createDicomRequest | 805 // convert the image into base64 for inclusing in the createDicomRequest |
806 std::string base64; | 806 std::string base64; |
807 | 807 |
808 { | 808 { |