X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=itk%2FclitkSliceBySliceRelativePositionFilter.txx;h=e68514da031c0f6f1a6725a2df78f97d0c189fe7;hb=2d9ef51e893a0b5b93d44a88594c9c76e4b61239;hp=a8d12ada76206a2ea10d79e0bf2d7a30b22d6341;hpb=dcb367e8756bc62560bb5ff67497b4c9328c3baa;p=clitk.git diff --git a/itk/clitkSliceBySliceRelativePositionFilter.txx b/itk/clitkSliceBySliceRelativePositionFilter.txx index a8d12ad..e68514d 100644 --- a/itk/clitkSliceBySliceRelativePositionFilter.txx +++ b/itk/clitkSliceBySliceRelativePositionFilter.txx @@ -42,6 +42,7 @@ SliceBySliceRelativePositionFilter(): SetObjectCCLSelectionDimension(0); SetObjectCCLSelectionDirection(1); ObjectCCLSelectionIgnoreSingleCCLFlagOff(); + VerboseSlicesFlagOff(); } //-------------------------------------------------------------------- @@ -77,7 +78,7 @@ clitk::SliceBySliceRelativePositionFilter:: PrintOptions(std::ostream & os) { os << "Slice direction = " << this->GetDirection() << std::endl - << "BG value = " << this->GetBackgroundValue() << std::endl; + << "BG value = " << (int)this->GetBackgroundValue() << std::endl; for(int i=0; iGetNumberOfAngles(); i++) { os << "Orientation = " << this->GetOrientationTypeString()[i] << std::endl; os << "Angles = " << clitk::rad2deg(this->GetAngle1InRad(i)) @@ -95,7 +96,9 @@ PrintOptions(std::ostream & os) << "ObjectCCLSelectionFlag = " << this->GetObjectCCLSelectionFlag() << std::endl << "ObjectCCLSelectionDimension = " << this->GetObjectCCLSelectionDimension() << std::endl << "ObjectCCLSelectionIgnoreSingleCCLFlag = " << this->GetObjectCCLSelectionIgnoreSingleCCLFlag() << std::endl - << "IgnoreEmptySliceObjectFlag = " << this->GetIgnoreEmptySliceObjectFlag() << std::endl; + << "IgnoreEmptySliceObjectFlag = " << this->GetIgnoreEmptySliceObjectFlag() << std::endl + << "(RP) FastFlag = " << this->GetFastFlag() << std::endl + << "(RP) Radius = " << this->GetRadius() << std::endl; } //-------------------------------------------------------------------- @@ -179,6 +182,13 @@ GenerateOutputInformation() m_working_object = clitk::ResizeImageLike(m_working_object, m_working_input, this->GetObjectBackgroundValue()); + + // Index can be negative in some cases, and lead to problem with + // some filter. So we correct it. + m_working_input = clitk::RemoveNegativeIndexFromRegion(m_working_input); + m_working_object = clitk::RemoveNegativeIndexFromRegion(m_working_object); + + // End this->template StopCurrentStep(m_working_input); } @@ -221,7 +231,7 @@ GenerateOutputInformation() //-------------------------------------------------------------------- // Perform slice by slice relative position - this->StartNewStep("Perform slice by slice relative position"); + this->StartNewStep("Perform slice by slice relative position ("+toString(mInputSlices.size())+")"); for(unsigned int i=0; i RelPosFilterType; typename RelPosFilterType::Pointer relPosFilter = RelPosFilterType::New(); - relPosFilter->VerboseStepFlagOff(); + if (GetVerboseSlicesFlag()) { + std::cout << "Slice " << i << std::endl; + relPosFilter->VerboseStepFlagOn(); + } relPosFilter->WriteStepFlagOff(); // relPosFilter->VerboseMemoryFlagOn(); - relPosFilter->SetCurrentStepBaseId(this->GetCurrentStepId()+"-"+toString(i)); - + relPosFilter->SetCurrentStepBaseId(this->GetCurrentStepId()+"-"+toString(i)); relPosFilter->SetBackgroundValue(this->GetBackgroundValue()); relPosFilter->SetInput(mInputSlices[i]); relPosFilter->SetInputObject(mObjectSlices[i]); - relPosFilter->SetRemoveObjectFlag(this->GetRemoveObjectFlag()); - + relPosFilter->SetRemoveObjectFlag(this->GetRemoveObjectFlag()); // This flag (InverseOrientation) *must* be set before // AddOrientation because AddOrientation can change it. relPosFilter->SetInverseOrientationFlag(this->GetInverseOrientationFlag()); @@ -303,11 +314,12 @@ GenerateOutputInformation() relPosFilter->SetFuzzyThreshold(this->GetFuzzyThreshold()); relPosFilter->AutoCropFlagOff(); // important ! because we join the slices after this loop relPosFilter->SetCombineWithOrFlag(this->GetCombineWithOrFlag()); - // should we stop after fuzzy map ? relPosFilter->SetFuzzyMapOnlyFlag(this->GetFuzzyMapOnlyFlag()); - // relPosFilter->SetComputeFuzzyMapFlag(this->GetComputeFuzzyMapFlag()); - + // relPosFilter->SetComputeFuzzyMapFlag(this->GetComputeFuzzyMapFlag()); + relPosFilter->SetFastFlag(this->GetFastFlag()); + relPosFilter->SetRadius(this->GetRadius()); + // Go ! relPosFilter->Update();