Mercurial > hg > orthanc-stone
comparison Framework/Volumes/VolumeReslicer.cpp @ 735:c3bbb130abc4
removing dependencies in ImageBuffer3D
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 21 May 2019 16:15:06 +0200 |
parents | 7719eb852dd5 |
children | fa5febe0f0c2 |
comparison
equal
deleted
inserted
replaced
734:be3671662eec | 735:c3bbb130abc4 |
---|---|
743 } | 743 } |
744 } | 744 } |
745 | 745 |
746 | 746 |
747 void VolumeReslicer::Apply(const ImageBuffer3D& source, | 747 void VolumeReslicer::Apply(const ImageBuffer3D& source, |
748 const VolumeImageGeometry& geometry, | |
748 const CoordinateSystem3D& plane) | 749 const CoordinateSystem3D& plane) |
749 { | 750 { |
750 // Choose the default voxel size as the finest voxel dimension | 751 // Choose the default voxel size as the finest voxel dimension |
751 // of the source volumetric image | 752 // of the source volumetric image |
752 const OrthancStone::Vector dim = | 753 const OrthancStone::Vector dim = |
753 source.GetGeometry().GetVoxelDimensions(OrthancStone::VolumeProjection_Axial); | 754 geometry.GetVoxelDimensions(OrthancStone::VolumeProjection_Axial); |
754 double voxelSize = dim[0]; | 755 double voxelSize = dim[0]; |
755 | 756 |
756 if (dim[1] < voxelSize) | 757 if (dim[1] < voxelSize) |
757 { | 758 { |
758 voxelSize = dim[1]; | 759 voxelSize = dim[1]; |
766 if (voxelSize <= 0) | 767 if (voxelSize <= 0) |
767 { | 768 { |
768 throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError); | 769 throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError); |
769 } | 770 } |
770 | 771 |
771 Apply(source, plane, voxelSize); | 772 Apply(source, geometry, plane, voxelSize); |
772 } | 773 } |
773 | 774 |
774 | 775 |
775 void VolumeReslicer::Apply(const ImageBuffer3D& source, | 776 void VolumeReslicer::Apply(const ImageBuffer3D& source, |
777 const VolumeImageGeometry& geometry, | |
776 const CoordinateSystem3D& plane, | 778 const CoordinateSystem3D& plane, |
777 double voxelSize) | 779 double voxelSize) |
778 { | 780 { |
779 Reset(); | 781 Reset(); |
780 | 782 |
781 // Firstly, compute the intersection of the source volumetric | 783 // Firstly, compute the intersection of the source volumetric |
782 // image with the reslicing plane. This leads to a polygon with 3 | 784 // image with the reslicing plane. This leads to a polygon with 3 |
783 // to 6 vertices. We compute the extent of the intersection | 785 // to 6 vertices. We compute the extent of the intersection |
784 // polygon, with respect to the coordinate system of the reslicing | 786 // polygon, with respect to the coordinate system of the reslicing |
785 // plane. | 787 // plane. |
786 OrientedBoundingBox box(source); | 788 OrientedBoundingBox box(geometry); |
787 | 789 |
788 if (!box.ComputeExtent(extent_, plane)) | 790 if (!box.ComputeExtent(extent_, plane)) |
789 { | 791 { |
790 // The plane does not intersect with the bounding box of the volume | 792 // The plane does not intersect with the bounding box of the volume |
791 slice_.reset(new Orthanc::Image(outputFormat_, 0, 0, false)); | 793 slice_.reset(new Orthanc::Image(outputFormat_, 0, 0, false)); |