Mercurial > hg > orthanc-stone
comparison OrthancStone/Sources/Toolbox/FiniteProjectiveCamera.cpp @ 1640:52b8b96cb55f
cleaning namespaces
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 10 Nov 2020 16:55:22 +0100 |
parents | 8563ea5d8ae4 |
children | 9ac2a65d4172 |
comparison
equal
deleted
inserted
replaced
1639:5cdc5b98f14d | 1640:52b8b96cb55f |
---|---|
316 LOG(WARNING) << "Input pixel format: " << Orthanc::EnumerationToString(source.GetFormat()); | 316 LOG(WARNING) << "Input pixel format: " << Orthanc::EnumerationToString(source.GetFormat()); |
317 LOG(WARNING) << "Output image size: " << target.GetWidth() << "x" << target.GetHeight(); | 317 LOG(WARNING) << "Output image size: " << target.GetWidth() << "x" << target.GetHeight(); |
318 LOG(WARNING) << "Output pixel format: " << Orthanc::EnumerationToString(target.GetFormat()); | 318 LOG(WARNING) << "Output pixel format: " << Orthanc::EnumerationToString(target.GetFormat()); |
319 | 319 |
320 const unsigned int slicesCount = geometry.GetProjectionDepth(projection); | 320 const unsigned int slicesCount = geometry.GetProjectionDepth(projection); |
321 const OrthancStone::Vector pixelSpacing = geometry.GetVoxelDimensions(projection); | 321 const Vector pixelSpacing = geometry.GetVoxelDimensions(projection); |
322 const unsigned int targetWidth = target.GetWidth(); | 322 const unsigned int targetWidth = target.GetWidth(); |
323 const unsigned int targetHeight = target.GetHeight(); | 323 const unsigned int targetHeight = target.GetHeight(); |
324 | 324 |
325 Orthanc::Image accumulator(Orthanc::PixelFormat_Float32, targetWidth, targetHeight, false); | 325 Orthanc::Image accumulator(Orthanc::PixelFormat_Float32, targetWidth, targetHeight, false); |
326 Orthanc::Image counter(Orthanc::PixelFormat_Grayscale16, targetWidth, targetHeight, false); | 326 Orthanc::Image counter(Orthanc::PixelFormat_Grayscale16, targetWidth, targetHeight, false); |
331 | 331 |
332 for (unsigned int z = 0; z < slicesCount; z++) | 332 for (unsigned int z = 0; z < slicesCount; z++) |
333 { | 333 { |
334 LOG(INFO) << "Applying raytracer on slice: " << z << "/" << slicesCount; | 334 LOG(INFO) << "Applying raytracer on slice: " << z << "/" << slicesCount; |
335 | 335 |
336 OrthancStone::CoordinateSystem3D slice = geometry.GetProjectionSlice(projection, z); | 336 CoordinateSystem3D slice = geometry.GetProjectionSlice(projection, z); |
337 OrthancStone::ImageBuffer3D::SliceReader sliceReader(source, projection, static_cast<unsigned int>(z)); | 337 ImageBuffer3D::SliceReader sliceReader(source, projection, static_cast<unsigned int>(z)); |
338 | 338 |
339 SourceReader pixelReader(sliceReader.GetAccessor()); | 339 SourceReader pixelReader(sliceReader.GetAccessor()); |
340 | 340 |
341 for (unsigned int y = 0; y < targetHeight; y++) | 341 for (unsigned int y = 0; y < targetHeight; y++) |
342 { | 342 { |
344 uint16_t *qcount = reinterpret_cast<uint16_t*>(counter.GetRow(y)); | 344 uint16_t *qcount = reinterpret_cast<uint16_t*>(counter.GetRow(y)); |
345 | 345 |
346 for (unsigned int x = 0; x < targetWidth; x++) | 346 for (unsigned int x = 0; x < targetWidth; x++) |
347 { | 347 { |
348 // Backproject the ray originating from the center of the target pixel | 348 // Backproject the ray originating from the center of the target pixel |
349 OrthancStone::Vector direction = camera.GetRayDirection(static_cast<double>(x + 0.5), | 349 Vector direction = camera.GetRayDirection(static_cast<double>(x + 0.5), |
350 static_cast<double>(y + 0.5)); | 350 static_cast<double>(y + 0.5)); |
351 | 351 |
352 // Compute the 3D intersection of the ray with the slice plane | 352 // Compute the 3D intersection of the ray with the slice plane |
353 OrthancStone::Vector p; | 353 Vector p; |
354 if (slice.IntersectLine(p, camera.GetCenter(), direction)) | 354 if (slice.IntersectLine(p, camera.GetCenter(), direction)) |
355 { | 355 { |
356 // Compute the 2D coordinates of the intersections, in slice coordinates | 356 // Compute the 2D coordinates of the intersections, in slice coordinates |
357 double ix, iy; | 357 double ix, iy; |
358 slice.ProjectPoint(ix, iy, p); | 358 slice.ProjectPoint(ix, iy, p); |