X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=itk%2FclitkSliceBySliceRelativePositionFilter.txx;h=16571ea7a224df6b17d87425d7cf8bde619a66b0;hb=5f801bf0b07486889123e941d6913d4369dfc86f;hp=eff331daa9e6d99269629f4ba6f112aca2fcec96;hpb=f6ec1c5f4f1c2105b428fe2d87e794417897a4e8;p=clitk.git diff --git a/itk/clitkSliceBySliceRelativePositionFilter.txx b/itk/clitkSliceBySliceRelativePositionFilter.txx index eff331d..16571ea 100644 --- a/itk/clitkSliceBySliceRelativePositionFilter.txx +++ b/itk/clitkSliceBySliceRelativePositionFilter.txx @@ -42,6 +42,8 @@ SliceBySliceRelativePositionFilter(): SetObjectCCLSelectionDimension(0); SetObjectCCLSelectionDirection(1); ObjectCCLSelectionIgnoreSingleCCLFlagOff(); + VerboseSlicesFlagOff(); + this->SetK1(vcl_acos(-1.0)/2); } //-------------------------------------------------------------------- @@ -77,7 +79,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)) @@ -97,7 +99,8 @@ PrintOptions(std::ostream & os) << "ObjectCCLSelectionIgnoreSingleCCLFlag = " << this->GetObjectCCLSelectionIgnoreSingleCCLFlag() << std::endl << "IgnoreEmptySliceObjectFlag = " << this->GetIgnoreEmptySliceObjectFlag() << std::endl << "(RP) FastFlag = " << this->GetFastFlag() << std::endl - << "(RP) Radius = " << this->GetRadius() << std::endl; + << "(RP) Radius = " << this->GetRadius() << std::endl + << "(RP) K1 = " << this->GetK1() << std::endl; } //-------------------------------------------------------------------- @@ -182,6 +185,11 @@ GenerateOutputInformation() 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); } @@ -232,6 +240,10 @@ GenerateOutputInformation() int nb=0; mObjectSlices[i] = LabelizeAndCountNumberOfObjects(mObjectSlices[i], 0, true, 1, nb); + if (GetVerboseSlicesFlag()) { + std::cout << "slice " << i << " nb = " << nb << std::endl; + } + // If no object and empty slices and if we need the full fuzzy map, create a dummy one. if ((nb==0) && (this->GetFuzzyMapOnlyFlag())) { typename FloatSliceType::Pointer one = FloatSliceType::New(); @@ -286,6 +298,11 @@ GenerateOutputInformation() typedef clitk::AddRelativePositionConstraintToLabelImageFilter RelPosFilterType; typename RelPosFilterType::Pointer relPosFilter = RelPosFilterType::New(); relPosFilter->VerboseStepFlagOff(); + if (GetVerboseSlicesFlag()) { + std::cout << "Slice " << i << std::endl; + relPosFilter->VerboseStepFlagOn(); + //relPosFilter->WriteStepFlagOn(); + } relPosFilter->WriteStepFlagOff(); // relPosFilter->VerboseMemoryFlagOn(); relPosFilter->SetCurrentStepBaseId(this->GetCurrentStepId()+"-"+toString(i)); @@ -309,6 +326,7 @@ GenerateOutputInformation() // relPosFilter->SetComputeFuzzyMapFlag(this->GetComputeFuzzyMapFlag()); relPosFilter->SetFastFlag(this->GetFastFlag()); relPosFilter->SetRadius(this->GetRadius()); + relPosFilter->SetK1(this->GetK1()); // Go ! relPosFilter->Update();