Mercurial > hg > orthanc-stone
comparison Framework/Toolbox/FiniteProjectiveCamera.cpp @ 811:ffec76a5f7eb
deprecating ParallelSlices
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 28 May 2019 18:21:00 +0200 |
parents | c3bbb130abc4 |
children | 2d8ab34c8c91 |
comparison
equal
deleted
inserted
replaced
810:7608e8107aa1 | 811:ffec76a5f7eb |
---|---|
21 | 21 |
22 #include "FiniteProjectiveCamera.h" | 22 #include "FiniteProjectiveCamera.h" |
23 | 23 |
24 #include "GeometryToolbox.h" | 24 #include "GeometryToolbox.h" |
25 #include "SubpixelReader.h" | 25 #include "SubpixelReader.h" |
26 #include "ParallelSlices.h" | |
27 | 26 |
28 #include <Core/Logging.h> | 27 #include <Core/Logging.h> |
29 #include <Core/OrthancException.h> | 28 #include <Core/OrthancException.h> |
30 #include <Core/Images/Image.h> | 29 #include <Core/Images/Image.h> |
31 #include <Core/Images/ImageProcessing.h> | 30 #include <Core/Images/ImageProcessing.h> |
315 << source.GetHeight() << "x" << source.GetDepth(); | 314 << source.GetHeight() << "x" << source.GetDepth(); |
316 LOG(WARNING) << "Input pixel format: " << Orthanc::EnumerationToString(source.GetFormat()); | 315 LOG(WARNING) << "Input pixel format: " << Orthanc::EnumerationToString(source.GetFormat()); |
317 LOG(WARNING) << "Output image size: " << target.GetWidth() << "x" << target.GetHeight(); | 316 LOG(WARNING) << "Output image size: " << target.GetWidth() << "x" << target.GetHeight(); |
318 LOG(WARNING) << "Output pixel format: " << Orthanc::EnumerationToString(target.GetFormat()); | 317 LOG(WARNING) << "Output pixel format: " << Orthanc::EnumerationToString(target.GetFormat()); |
319 | 318 |
320 std::auto_ptr<OrthancStone::ParallelSlices> slices(OrthancStone::ParallelSlices::FromVolumeImage(geometry, projection)); | 319 const unsigned int slicesCount = geometry.GetProjectionDepth(projection); |
321 const OrthancStone::Vector pixelSpacing = geometry.GetVoxelDimensions(projection); | 320 const OrthancStone::Vector pixelSpacing = geometry.GetVoxelDimensions(projection); |
322 const unsigned int targetWidth = target.GetWidth(); | 321 const unsigned int targetWidth = target.GetWidth(); |
323 const unsigned int targetHeight = target.GetHeight(); | 322 const unsigned int targetHeight = target.GetHeight(); |
324 | 323 |
325 Orthanc::Image accumulator(Orthanc::PixelFormat_Float32, targetWidth, targetHeight, false); | 324 Orthanc::Image accumulator(Orthanc::PixelFormat_Float32, targetWidth, targetHeight, false); |
327 Orthanc::ImageProcessing::Set(accumulator, 0); | 326 Orthanc::ImageProcessing::Set(accumulator, 0); |
328 Orthanc::ImageProcessing::Set(counter, 0); | 327 Orthanc::ImageProcessing::Set(counter, 0); |
329 | 328 |
330 typedef SubpixelReader<SourceFormat, ImageInterpolation_Nearest> SourceReader; | 329 typedef SubpixelReader<SourceFormat, ImageInterpolation_Nearest> SourceReader; |
331 | 330 |
332 for (size_t z = 0; z < slices->GetSliceCount(); z++) | 331 for (unsigned int z = 0; z < slicesCount; z++) |
333 { | 332 { |
334 LOG(INFO) << "Applying raytracer on slice: " << z << "/" << slices->GetSliceCount(); | 333 LOG(INFO) << "Applying raytracer on slice: " << z << "/" << slicesCount; |
335 | 334 |
336 const OrthancStone::CoordinateSystem3D& slice = slices->GetSlice(z); | 335 OrthancStone::CoordinateSystem3D slice = geometry.GetProjectionSlice(projection, z); |
337 OrthancStone::ImageBuffer3D::SliceReader sliceReader(source, projection, static_cast<unsigned int>(z)); | 336 OrthancStone::ImageBuffer3D::SliceReader sliceReader(source, projection, static_cast<unsigned int>(z)); |
338 | 337 |
339 SourceReader pixelReader(sliceReader.GetAccessor()); | 338 SourceReader pixelReader(sliceReader.GetAccessor()); |
340 | 339 |
341 for (unsigned int y = 0; y < targetHeight; y++) | 340 for (unsigned int y = 0; y < targetHeight; y++) |