typename itk::BoundingBox<unsigned long, Dimension>::Pointer bbi1,
typename itk::BoundingBox<unsigned long, Dimension>::Pointer bbi2);
+ //--------------------------------------------------------------------
+ template<int Dimension>
+ void ComputeBBUnion(typename itk::BoundingBox<unsigned long, Dimension>::Pointer bbo,
+ typename itk::BoundingBox<unsigned long, Dimension>::Pointer bbi1,
+ typename itk::BoundingBox<unsigned long, Dimension>::Pointer bbi2);
+
//--------------------------------------------------------------------
template<class ImageType>
void ComputeRegionFromBB(const ImageType * image,
const typename itk::BoundingBox<unsigned long,
ImageType::ImageDimension>::Pointer bb,
typename ImageType::RegionType & region);
+
} // end clitk namespace
#include "clitkBoundingBoxUtils.txx"
void ComputeBBIntersection(typename itk::BoundingBox<unsigned long, Dimension>::Pointer bbo,
typename itk::BoundingBox<unsigned long, Dimension>::Pointer bbi1,
typename itk::BoundingBox<unsigned long, Dimension>::Pointer bbi2) {
-
typedef itk::BoundingBox<unsigned long, Dimension> BBType;
typedef typename BBType::PointType PointType;
PointType lastPoint;
PointType firstPoint;
-
for(unsigned int i=0; i<Dimension; i++) {
- firstPoint[i] = std::max(bbi1->GetMinimum()[i],
- bbi2->GetMinimum()[i]);
- lastPoint[i] = std::min(bbi1->GetMaximum()[i],
- bbi2->GetMaximum()[i]);
+ firstPoint[i] = std::max(bbi1->GetMinimum()[i], bbi2->GetMinimum()[i]);
+ lastPoint[i] = std::min(bbi1->GetMaximum()[i], bbi2->GetMaximum()[i]);
}
+ bbo->SetMaximum(lastPoint);
+ bbo->SetMinimum(firstPoint);
+ }
+ //--------------------------------------------------------------------
+
+ ///--------------------------------------------------------------------
+ template<int Dimension>
+ void ComputeBBUnion(typename itk::BoundingBox<unsigned long, Dimension>::Pointer bbo,
+ typename itk::BoundingBox<unsigned long, Dimension>::Pointer bbi1,
+ typename itk::BoundingBox<unsigned long, Dimension>::Pointer bbi2) {
+ typedef itk::BoundingBox<unsigned long, Dimension> BBType;
+ typedef typename BBType::PointType PointType;
+ PointType lastPoint;
+ PointType firstPoint;
+ for(unsigned int i=0; i<Dimension; i++) {
+ firstPoint[i] = std::min(bbi1->GetMinimum()[i], bbi2->GetMinimum()[i]);
+ lastPoint[i] = std::max(bbi1->GetMaximum()[i], bbi2->GetMaximum()[i]);
+ }
bbo->SetMaximum(lastPoint);
bbo->SetMinimum(firstPoint);
}