]> Creatis software - clitk.git/commitdiff
Add SliceBySliceRelativePosition with angles
authorDavid Sarrut <david.sarrut@gmail.com>
Mon, 24 Oct 2011 06:29:29 +0000 (08:29 +0200)
committerDavid Sarrut <david.sarrut@gmail.com>
Mon, 24 Oct 2011 06:29:29 +0000 (08:29 +0200)
itk/clitkSegmentationUtils.h
itk/clitkSegmentationUtils.txx

index cd1612aa8f513ba371ced207fbd270d6f9f38b92..6972d154ab8f4436a672247090da66efff9eb331 100644 (file)
@@ -130,6 +130,18 @@ namespace clitk {
                                double spacing=-1, 
                                bool autocropflag=true, 
                                bool singleObjectCCL=true);
+  template<class MaskImageType>
+  typename MaskImageType::Pointer
+  SliceBySliceRelativePosition(const MaskImageType * input,
+                              const MaskImageType * object,
+                              int direction, 
+                              double threshold, 
+                              double angle, 
+                               bool inverseflag,
+                               bool uniqueConnectedComponent=false, 
+                               double spacing=-1, 
+                               bool autocropflag=true, 
+                               bool singleObjectCCL=true);
 
   //--------------------------------------------------------------------
   // In a binary image, search for the point belonging to the FG that
index 3022ad25f7a9844f07102dd06bfb59e5916659b0..8fe69a0b13cdfaad0a98819090d35d0ba765a731 100644 (file)
@@ -265,6 +265,44 @@ namespace clitk {
   //--------------------------------------------------------------------
 
 
+  //--------------------------------------------------------------------
+  template<class MaskImageType>
+  typename MaskImageType::Pointer
+  SliceBySliceRelativePosition(const MaskImageType * input,
+                               const MaskImageType * object,
+                               int direction, 
+                               double threshold, 
+                               double angle,
+                               bool inverseflag,
+                               bool uniqueConnectedComponent, 
+                               double spacing, 
+                               bool autocropFlag, 
+                               bool singleObjectCCL) 
+  {
+    typedef clitk::SliceBySliceRelativePositionFilter<MaskImageType> SliceRelPosFilterType;
+    typename SliceRelPosFilterType::Pointer sliceRelPosFilter = SliceRelPosFilterType::New();
+    sliceRelPosFilter->VerboseStepFlagOff();
+    sliceRelPosFilter->WriteStepFlagOff();
+    sliceRelPosFilter->SetInput(input);
+    sliceRelPosFilter->SetInputObject(object);
+    sliceRelPosFilter->SetDirection(direction);
+    sliceRelPosFilter->SetFuzzyThreshold(threshold);
+    //    sliceRelPosFilter->AddOrientationTypeString(orientation);
+    sliceRelPosFilter->AddAngles(angle, 0.0);
+    sliceRelPosFilter->SetIntermediateSpacingFlag((spacing != -1));
+    sliceRelPosFilter->SetIntermediateSpacing(spacing);
+    sliceRelPosFilter->SetUniqueConnectedComponentBySliceFlag(uniqueConnectedComponent);
+    sliceRelPosFilter->ObjectCCLSelectionFlagOff();
+    sliceRelPosFilter->SetUseTheLargestObjectCCLFlag(singleObjectCCL);
+    sliceRelPosFilter->SetInverseOrientationFlag(inverseflag); 
+    sliceRelPosFilter->SetAutoCropFlag(autocropFlag); 
+    sliceRelPosFilter->IgnoreEmptySliceObjectFlagOn();
+    sliceRelPosFilter->Update();
+    return sliceRelPosFilter->GetOutput();
+  }
+  //--------------------------------------------------------------------
+
+
   //--------------------------------------------------------------------
   template<class ImageType>
   bool