From: srit Date: Sat, 26 Feb 2011 16:47:18 +0000 (+0000) Subject: Change namespace handling for MSVC++ compilation X-Git-Tag: v1.2.0~228 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=46acae08f9deb8c240a11b6106601e1e72f29478;p=clitk.git Change namespace handling for MSVC++ compilation --- diff --git a/itk/clitkSegmentationUtils.txx b/itk/clitkSegmentationUtils.txx index c8f976e..1760395 100644 --- a/itk/clitkSegmentationUtils.txx +++ b/itk/clitkSegmentationUtils.txx @@ -33,12 +33,14 @@ #include #include +namespace clitk { + //-------------------------------------------------------------------- template -void clitk::ComputeBBFromImageRegion(typename ImageType::Pointer image, - typename ImageType::RegionType region, - typename itk::BoundingBox::Pointer bb) { +void ComputeBBFromImageRegion(typename ImageType::Pointer image, + typename ImageType::RegionType region, + typename itk::BoundingBox::Pointer bb) { typedef typename ImageType::IndexType IndexType; IndexType firstIndex; IndexType lastIndex; @@ -63,9 +65,9 @@ void clitk::ComputeBBFromImageRegion(typename ImageType::Pointer image, //-------------------------------------------------------------------- template -void clitk::ComputeBBIntersection(typename itk::BoundingBox::Pointer bbo, - typename itk::BoundingBox::Pointer bbi1, - typename itk::BoundingBox::Pointer bbi2) { +void ComputeBBIntersection(typename itk::BoundingBox::Pointer bbo, + typename itk::BoundingBox::Pointer bbi1, + typename itk::BoundingBox::Pointer bbi2) { typedef itk::BoundingBox BBType; typedef typename BBType::PointType PointType; @@ -87,10 +89,10 @@ void clitk::ComputeBBIntersection(typename itk::BoundingBox -void clitk::ComputeRegionFromBB(typename ImageType::Pointer image, - const typename itk::BoundingBox::Pointer bb, - typename ImageType::RegionType & region) { +void ComputeRegionFromBB(typename ImageType::Pointer image, + const typename itk::BoundingBox::Pointer bb, + typename ImageType::RegionType & region) { // Types typedef typename ImageType::IndexType IndexType; typedef typename ImageType::PointType PointType; @@ -123,12 +125,12 @@ void clitk::ComputeRegionFromBB(typename ImageType::Pointer image, //-------------------------------------------------------------------- template typename ImageType::Pointer -clitk::SetBackground(const ImageType * input, - const TMaskImageType * mask, - typename TMaskImageType::PixelType maskBG, - typename ImageType::PixelType outValue, - bool inPlace) { - typedef clitk::SetBackgroundImageFilter +SetBackground(const ImageType * input, + const TMaskImageType * mask, + typename TMaskImageType::PixelType maskBG, + typename ImageType::PixelType outValue, + bool inPlace) { + typedef SetBackgroundImageFilter SetBackgroundImageFilterType; typename SetBackgroundImageFilterType::Pointer setBackgroundFilter = SetBackgroundImageFilterType::New(); @@ -146,9 +148,9 @@ clitk::SetBackground(const ImageType * input, //-------------------------------------------------------------------- template -int clitk::GetNumberOfConnectedComponentLabels(typename ImageType::Pointer input, - typename ImageType::PixelType BG, - bool isFullyConnected) { +int GetNumberOfConnectedComponentLabels(typename ImageType::Pointer input, + typename ImageType::PixelType BG, + bool isFullyConnected) { // Connected Component label typedef itk::ConnectedComponentImageFilter ConnectFilterType; typename ConnectFilterType::Pointer connectFilter = ConnectFilterType::New(); @@ -169,10 +171,10 @@ int clitk::GetNumberOfConnectedComponentLabels(typename ImageType::Pointer input */ template typename ImageType::Pointer -clitk::Labelize(const ImageType * input, - typename ImageType::PixelType BG, - bool isFullyConnected, - int minimalComponentSize) { +Labelize(const ImageType * input, + typename ImageType::PixelType BG, + bool isFullyConnected, + int minimalComponentSize) { // InternalImageType for storing large number of component typedef itk::Image InternalImageType; @@ -210,11 +212,11 @@ clitk::Labelize(const ImageType * input, */ template typename ImageType::Pointer -clitk::LabelizeAndCountNumberOfObjects(const ImageType * input, - typename ImageType::PixelType BG, - bool isFullyConnected, - int minimalComponentSize, - int & nb) { +LabelizeAndCountNumberOfObjects(const ImageType * input, + typename ImageType::PixelType BG, + bool isFullyConnected, + int minimalComponentSize, + int & nb) { // InternalImageType for storing large number of component typedef itk::Image InternalImageType; @@ -250,12 +252,12 @@ clitk::LabelizeAndCountNumberOfObjects(const ImageType * input, //-------------------------------------------------------------------- template typename ImageType::Pointer -clitk::RemoveLabels(typename ImageType::Pointer input, - typename ImageType::PixelType BG, - std::vector & labelsToRemove) { +RemoveLabels(typename ImageType::Pointer input, + typename ImageType::PixelType BG, + std::vector & labelsToRemove) { typename ImageType::Pointer working_image = input; for (unsigned int i=0; i SetBackgroundImageFilterType; + typedef SetBackgroundImageFilter SetBackgroundImageFilterType; typename SetBackgroundImageFilterType::Pointer setBackgroundFilter = SetBackgroundImageFilterType::New(); setBackgroundFilter->SetInput(input); setBackgroundFilter->SetInput2(input); @@ -272,12 +274,12 @@ clitk::RemoveLabels(typename ImageType::Pointer input, //-------------------------------------------------------------------- template typename ImageType::Pointer -clitk::KeepLabels(const ImageType * input, - typename ImageType::PixelType BG, - typename ImageType::PixelType FG, - typename ImageType::PixelType firstKeep, - typename ImageType::PixelType lastKeep, - bool useLastKeep) { +KeepLabels(const ImageType * input, + typename ImageType::PixelType BG, + typename ImageType::PixelType FG, + typename ImageType::PixelType firstKeep, + typename ImageType::PixelType lastKeep, + bool useLastKeep) { typedef itk::BinaryThresholdImageFilter BinarizeFilterType; typename BinarizeFilterType::Pointer binarizeFilter = BinarizeFilterType::New(); binarizeFilter->SetInput(input); @@ -294,12 +296,12 @@ clitk::KeepLabels(const ImageType * input, //-------------------------------------------------------------------- template typename ImageType::Pointer -clitk::LabelizeAndSelectLabels(typename ImageType::Pointer input, - typename ImageType::PixelType BG, - typename ImageType::PixelType FG, - bool isFullyConnected, - int minimalComponentSize, - LabelizeParameters * param) +LabelizeAndSelectLabels(typename ImageType::Pointer input, + typename ImageType::PixelType BG, + typename ImageType::PixelType FG, + bool isFullyConnected, + int minimalComponentSize, + LabelizeParameters * param) { typename ImageType::Pointer working_image; working_image = Labelize(input, BG, isFullyConnected, minimalComponentSize); @@ -317,11 +319,11 @@ clitk::LabelizeAndSelectLabels(typename ImageType::Pointer input, //-------------------------------------------------------------------- template typename ImageType::Pointer -clitk::ResizeImageLike(typename ImageType::Pointer input, - typename ImageType::Pointer like, - typename ImageType::PixelType backgroundValue) +ResizeImageLike(typename ImageType::Pointer input, + typename ImageType::Pointer like, + typename ImageType::PixelType backgroundValue) { - typedef clitk::CropLikeImageFilter CropFilterType; + typedef CropLikeImageFilter CropFilterType; typename CropFilterType::Pointer cropFilter = CropFilterType::New(); cropFilter->SetInput(input); cropFilter->SetCropLikeImage(like); @@ -335,16 +337,16 @@ clitk::ResizeImageLike(typename ImageType::Pointer input, //-------------------------------------------------------------------- template typename MaskImageType::Pointer -clitk::SliceBySliceRelativePosition(const MaskImageType * input, - const MaskImageType * object, - int direction, - double threshold, - std::string orientation, - bool uniqueConnectedComponent, - double spacing, - bool inverseflag) +SliceBySliceRelativePosition(const MaskImageType * input, + const MaskImageType * object, + int direction, + double threshold, + std::string orientation, + bool uniqueConnectedComponent, + double spacing, + bool inverseflag) { - typedef clitk::SliceBySliceRelativePositionFilter SliceRelPosFilterType; + typedef SliceBySliceRelativePositionFilter SliceRelPosFilterType; typename SliceRelPosFilterType::Pointer sliceRelPosFilter = SliceRelPosFilterType::New(); sliceRelPosFilter->VerboseStepFlagOff(); sliceRelPosFilter->WriteStepFlagOff(); @@ -366,26 +368,26 @@ clitk::SliceBySliceRelativePosition(const MaskImageType * input, //-------------------------------------------------------------------- template bool -clitk::FindExtremaPointInAGivenDirection(const ImageType * input, - typename ImageType::PixelType bg, - int direction, bool opposite, - typename ImageType::PointType & point) +FindExtremaPointInAGivenDirection(const ImageType * input, + typename ImageType::PixelType bg, + int direction, bool opposite, + typename ImageType::PointType & point) { typename ImageType::PointType dummy; - return clitk::FindExtremaPointInAGivenDirection(input, bg, direction, - opposite, dummy, 0, point); + return FindExtremaPointInAGivenDirection(input, bg, direction, + opposite, dummy, 0, point); } //-------------------------------------------------------------------- //-------------------------------------------------------------------- template bool -clitk::FindExtremaPointInAGivenDirection(const ImageType * input, - typename ImageType::PixelType bg, - int direction, bool opposite, - typename ImageType::PointType refpoint, - double distanceMax, - typename ImageType::PointType & point) +FindExtremaPointInAGivenDirection(const ImageType * input, + typename ImageType::PixelType bg, + int direction, bool opposite, + typename ImageType::PointType refpoint, + double distanceMax, + typename ImageType::PointType & point) { /* loop over input pixels, store the index in the fg that is max @@ -422,15 +424,15 @@ clitk::FindExtremaPointInAGivenDirection(const ImageType * input, //-------------------------------------------------------------------- template typename ImageType::Pointer -clitk::CropImageAbove(typename ImageType::Pointer image, - int dim, double min, - bool autoCrop, - typename ImageType::PixelType BG) +CropImageAbove(typename ImageType::Pointer image, + int dim, double min, + bool autoCrop, + typename ImageType::PixelType BG) { - return clitk::CropImageAlongOneAxis(image, dim, - image->GetOrigin()[dim], - min, - autoCrop, BG); + return CropImageAlongOneAxis(image, dim, + image->GetOrigin()[dim], + min, + autoCrop, BG); } //-------------------------------------------------------------------- @@ -438,15 +440,15 @@ clitk::CropImageAbove(typename ImageType::Pointer image, //-------------------------------------------------------------------- template typename ImageType::Pointer -clitk::CropImageBelow(typename ImageType::Pointer image, - int dim, double max, - bool autoCrop, - typename ImageType::PixelType BG) +CropImageBelow(typename ImageType::Pointer image, + int dim, double max, + bool autoCrop, + typename ImageType::PixelType BG) { typename ImageType::PointType p; image->TransformIndexToPhysicalPoint(image->GetLargestPossibleRegion().GetIndex()+ image->GetLargestPossibleRegion().GetSize(), p); - return clitk::CropImageAlongOneAxis(image, dim, max, p[dim], autoCrop, BG); + return CropImageAlongOneAxis(image, dim, max, p[dim], autoCrop, BG); } //-------------------------------------------------------------------- @@ -454,10 +456,10 @@ clitk::CropImageBelow(typename ImageType::Pointer image, //-------------------------------------------------------------------- template typename ImageType::Pointer -clitk::CropImageAlongOneAxis(typename ImageType::Pointer image, - int dim, double min, double max, - bool autoCrop, - typename ImageType::PixelType BG) +CropImageAlongOneAxis(typename ImageType::Pointer image, + int dim, double min, double max, + bool autoCrop, + typename ImageType::PixelType BG) { // Compute region size typename ImageType::RegionType region; @@ -483,7 +485,7 @@ clitk::CropImageAlongOneAxis(typename ImageType::Pointer image, // Auto Crop if (autoCrop) { - result = clitk::AutoCrop(result, BG); + result = AutoCrop(result, BG); } return result; } @@ -493,7 +495,7 @@ clitk::CropImageAlongOneAxis(typename ImageType::Pointer image, //-------------------------------------------------------------------- template void -clitk::ComputeCentroids(typename ImageType::Pointer image, +ComputeCentroids(typename ImageType::Pointer image, typename ImageType::PixelType BG, std::vector & centroids) { @@ -524,12 +526,12 @@ clitk::ComputeCentroids(typename ImageType::Pointer image, //-------------------------------------------------------------------- template void -clitk::ExtractSlices(typename ImageType::Pointer image, - int direction, - std::vector::Pointer > & slices) +ExtractSlices(typename ImageType::Pointer image, + int direction, + std::vector::Pointer > & slices) { - typedef clitk::ExtractSliceFilter ExtractSliceFilterType; + typedef ExtractSliceFilter ExtractSliceFilterType; typedef typename ExtractSliceFilterType::SliceType SliceType; typename ExtractSliceFilterType::Pointer extractSliceFilter = ExtractSliceFilterType::New(); @@ -544,10 +546,10 @@ clitk::ExtractSlices(typename ImageType::Pointer image, //-------------------------------------------------------------------- template typename ImageType::Pointer -clitk::JoinSlices(std::vector::Pointer > & slices, - typename ImageType::Pointer input, - int direction) { +JoinSlices(std::vector::Pointer > & slices, + typename ImageType::Pointer input, + int direction) { typedef typename itk::Image SliceType; typedef itk::JoinSeriesImageFilter JoinSeriesFilterType; typename JoinSeriesFilterType::Pointer joinFilter = JoinSeriesFilterType::New(); @@ -565,10 +567,10 @@ clitk::JoinSlices(std::vector void -clitk::PointsUtils::Convert2DTo3D(const PointType2D & p, - ImagePointer image, - const int slice, - PointType3D & p3D) +PointsUtils::Convert2DTo3D(const PointType2D & p, + ImagePointer image, + const int slice, + PointType3D & p3D) { p3D[0] = p[0]; p3D[1] = p[1]; @@ -581,9 +583,9 @@ clitk::PointsUtils::Convert2DTo3D(const PointType2D & p, //-------------------------------------------------------------------- template void -clitk::PointsUtils::Convert2DTo3DList(const MapPoint2DType & map, - ImagePointer image, - VectorPoint3DType & list) +PointsUtils::Convert2DTo3DList(const MapPoint2DType & map, + ImagePointer image, + VectorPoint3DType & list) { typename MapPoint2DType::const_iterator iter = map.begin(); while (iter != map.end()) { @@ -598,8 +600,8 @@ clitk::PointsUtils::Convert2DTo3DList(const MapPoint2DType & map, //-------------------------------------------------------------------- template void -clitk::WriteListOfLandmarks(std::vector points, - std::string filename) +WriteListOfLandmarks(std::vector points, + std::string filename) { std::ofstream os; openFileForWriting(os, filename); @@ -617,16 +619,16 @@ clitk::WriteListOfLandmarks(std::vector points, //-------------------------------------------------------------------- template typename ImageType::Pointer -clitk::Dilate(typename ImageType::Pointer image, - double radiusInMM, - typename ImageType::PixelType BG, - typename ImageType::PixelType FG, - bool extendSupport) +Dilate(typename ImageType::Pointer image, + double radiusInMM, + typename ImageType::PixelType BG, + typename ImageType::PixelType FG, + bool extendSupport) { typename ImageType::SizeType r; for(uint i=0; iGetSpacing()[i]); - return clitk::Dilate(image, r, BG, FG, extendSupport); + return Dilate(image, r, BG, FG, extendSupport); } //-------------------------------------------------------------------- @@ -634,16 +636,16 @@ clitk::Dilate(typename ImageType::Pointer image, //-------------------------------------------------------------------- template typename ImageType::Pointer -clitk::Dilate(typename ImageType::Pointer image, - typename ImageType::PointType radiusInMM, - typename ImageType::PixelType BG, - typename ImageType::PixelType FG, - bool extendSupport) +Dilate(typename ImageType::Pointer image, + typename ImageType::PointType radiusInMM, + typename ImageType::PixelType BG, + typename ImageType::PixelType FG, + bool extendSupport) { typename ImageType::SizeType r; for(uint i=0; iGetSpacing()[i]); - return clitk::Dilate(image, r, BG, FG, extendSupport); + return Dilate(image, r, BG, FG, extendSupport); } //-------------------------------------------------------------------- @@ -651,11 +653,11 @@ clitk::Dilate(typename ImageType::Pointer image, //-------------------------------------------------------------------- template typename ImageType::Pointer -clitk::Dilate(typename ImageType::Pointer image, - typename ImageType::SizeType radius, - typename ImageType::PixelType BG, - typename ImageType::PixelType FG, - bool extendSupport) +Dilate(typename ImageType::Pointer image, + typename ImageType::SizeType radius, + typename ImageType::PixelType BG, + typename ImageType::PixelType FG, + bool extendSupport) { // Create kernel for dilatation typedef itk::BinaryBallStructuringElement -void clitk::ConvertOption(std::string optionName, uint given, - ValueType * values, VectorType & p, - uint dim, bool required) +void ConvertOption(std::string optionName, uint given, + ValueType * values, VectorType & p, + uint dim, bool required) { if (required && (given == 0)) { clitkExceptionMacro("The option --" << optionName << " must be set and have 1 or " @@ -733,12 +735,12 @@ void clitk::ConvertOption(std::string optionName, uint given, */ template void -clitk::SliceBySliceSetBackgroundFromLineSeparation(typename ImageType::Pointer input, - std::vector & lA, - std::vector & lB, - typename ImageType::PixelType BG, - int mainDirection, - double offsetToKeep) +SliceBySliceSetBackgroundFromLineSeparation(typename ImageType::Pointer input, + std::vector & lA, + std::vector & lB, + typename ImageType::PixelType BG, + int mainDirection, + double offsetToKeep) { typedef itk::ImageSliceIteratorWithIndex SliceIteratorType; @@ -788,3 +790,4 @@ clitk::SliceBySliceSetBackgroundFromLineSeparation(typename ImageType::Pointer i } } //-------------------------------------------------------------------- +}