namespace clitk {
//--------------------------------------------------------------------
- template<class ImageType>
- void ComputeBBFromImageRegion(const ImageType * image,
- typename ImageType::RegionType region,
- typename itk::BoundingBox<unsigned long,
- ImageType::ImageDimension>::Pointer bb);
-
- //--------------------------------------------------------------------
- template<int Dimension>
- 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);
-
- //--------------------------------------------------------------------
- template<class ImageType>
- void ComputeRegionFromBB(const ImageType * image,
- const typename itk::BoundingBox<unsigned long,
- ImageType::ImageDimension>::Pointer bb,
- typename ImageType::RegionType & region);
- //--------------------------------------------------------------------
template<class TInternalImageType, class TMaskInternalImageType>
typename TInternalImageType::Pointer
SetBackground(const TInternalImageType * input,
int minimalComponentSize,
LabelizeParameters<typename TImageType::PixelType> * param);
- //--------------------------------------------------------------------
- template<class ImageType>
- typename ImageType::Pointer
- ResizeImageLike(const ImageType * input,
- const itk::ImageBase<ImageType::ImageDimension> * like,
- typename ImageType::PixelType BG);
-
//--------------------------------------------------------------------
template<class MaskImageType>
namespace clitk {
- //--------------------------------------------------------------------
- template<class ImageType>
- void ComputeBBFromImageRegion(const ImageType * image,
- typename ImageType::RegionType region,
- typename itk::BoundingBox<unsigned long,
- ImageType::ImageDimension>::Pointer bb) {
- typedef typename ImageType::IndexType IndexType;
- IndexType firstIndex;
- IndexType lastIndex;
- for(unsigned int i=0; i<image->GetImageDimension(); i++) {
- firstIndex[i] = region.GetIndex()[i];
- lastIndex[i] = firstIndex[i]+region.GetSize()[i];
- }
-
- typedef itk::BoundingBox<unsigned long,
- ImageType::ImageDimension> BBType;
- typedef typename BBType::PointType PointType;
- PointType lastPoint;
- PointType firstPoint;
- image->TransformIndexToPhysicalPoint(firstIndex, firstPoint);
- image->TransformIndexToPhysicalPoint(lastIndex, lastPoint);
-
- bb->SetMaximum(lastPoint);
- bb->SetMinimum(firstPoint);
- }
- //--------------------------------------------------------------------
-
-
- //--------------------------------------------------------------------
- template<int Dimension>
- 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]);
- }
-
- bbo->SetMaximum(lastPoint);
- bbo->SetMinimum(firstPoint);
- }
- //--------------------------------------------------------------------
-
-
- //--------------------------------------------------------------------
- template<class ImageType>
- void ComputeRegionFromBB(const ImageType * image,
- const typename itk::BoundingBox<unsigned long,
- ImageType::ImageDimension>::Pointer bb,
- typename ImageType::RegionType & region) {
- // Types
- typedef typename ImageType::IndexType IndexType;
- typedef typename ImageType::PointType PointType;
- typedef typename ImageType::RegionType RegionType;
- typedef typename ImageType::SizeType SizeType;
-
- // Region starting point
- IndexType regionStart;
- PointType start = bb->GetMinimum();
- image->TransformPhysicalPointToIndex(start, regionStart);
-
- // Region size
- SizeType regionSize;
- PointType maxs = bb->GetMaximum();
- PointType mins = bb->GetMinimum();
- for(unsigned int i=0; i<ImageType::ImageDimension; i++) {
- regionSize[i] = lrint((maxs[i] - mins[i])/image->GetSpacing()[i]);
- }
-
- // Create region
- region.SetIndex(regionStart);
- region.SetSize(regionSize);
- }
- //--------------------------------------------------------------------
-
//--------------------------------------------------------------------
template<class ImageType, class TMaskImageType>
typename ImageType::Pointer
//--------------------------------------------------------------------
- //--------------------------------------------------------------------
- template<class ImageType>
- typename ImageType::Pointer
- ResizeImageLike(const ImageType * input,
- const itk::ImageBase<ImageType::ImageDimension> * like,
- typename ImageType::PixelType backgroundValue)
- {
- typedef CropLikeImageFilter<ImageType> CropFilterType;
- typename CropFilterType::Pointer cropFilter = CropFilterType::New();
- cropFilter->SetInput(input);
- cropFilter->SetCropLikeImage(like);
- cropFilter->SetBackgroundValue(backgroundValue);
- cropFilter->Update();
- return cropFilter->GetOutput();
- }
- //--------------------------------------------------------------------
-
-
//--------------------------------------------------------------------
template<class MaskImageType>
typename MaskImageType::Pointer
bool autocropFlag,
bool singleObjectCCL)
{
- typedef SliceBySliceRelativePositionFilter<MaskImageType> SliceRelPosFilterType;
+ typedef clitk::SliceBySliceRelativePositionFilter<MaskImageType> SliceRelPosFilterType;
typename SliceRelPosFilterType::Pointer sliceRelPosFilter = SliceRelPosFilterType::New();
sliceRelPosFilter->VerboseStepFlagOff();
sliceRelPosFilter->WriteStepFlagOff();