- } // end GetbjectCCLSelectionFlag = true
-
- // Relative position
- typedef clitk::AddRelativePositionConstraintToLabelImageFilter<SliceType> RelPosFilterType;
- typename RelPosFilterType::Pointer relPosFilter = RelPosFilterType::New();
-
- relPosFilter->VerboseStepFlagOff();
- relPosFilter->WriteStepFlagOff();
- relPosFilter->SetBackgroundValue(this->GetBackgroundValue());
- relPosFilter->SetInput(mInputSlices[i]);
- relPosFilter->SetInputObject(mObjectSlices[i]);
- relPosFilter->SetRemoveObjectFlag(this->GetRemoveObjectFlag());
- // This flag (InverseOrientation) *must* be set before
- // AddOrientation because AddOrientation can change it.
- relPosFilter->SetInverseOrientationFlag(this->GetInverseOrientationFlag());
- for(int j=0; j<this->GetNumberOfAngles(); j++) {
- relPosFilter->AddOrientationTypeString(this->GetOrientationTypeString(j));
- //DD(this->GetOrientationTypeString(j));
- }
- //DD(this->GetInverseOrientationFlag());
- //relPosFilter->SetOrientationType(this->GetOrientationType());
- relPosFilter->SetIntermediateSpacing(this->GetIntermediateSpacing());
- relPosFilter->SetIntermediateSpacingFlag(this->GetIntermediateSpacingFlag());
- relPosFilter->SetFuzzyThreshold(this->GetFuzzyThreshold());
- relPosFilter->AutoCropFlagOff(); // important ! because we join the slices after this loop
- relPosFilter->SetCombineWithOrFlag(this->GetCombineWithOrFlag());
- relPosFilter->Update();
- mInputSlices[i] = relPosFilter->GetOutput();
-
- // Select main CC if needed
- if (GetUniqueConnectedComponentBySliceFlag()) {
- mInputSlices[i] = Labelize<SliceType>(mInputSlices[i], 0, true, 1);
- mInputSlices[i] = KeepLabels<SliceType>(mInputSlices[i], 0, 1, 1, 1, true);
- }