- for(int i=0; i<m_ListOfAngles.size(); i++) {
- // Compute Fuzzy map
- typename FloatImageType::Pointer map = ComputeFuzzyMap(objectLikeTarget, m_Target, m_ListOfAngles[i]);
- writeImage<FloatImageType>(map, "fuzzy_"+toString(i)+".mha");
-
- // Compute the optimal thresholds (direct and inverse)
- double mThreshold=0.0;
- double mReverseThreshold=1.0;
- ComputeOptimalThresholds(map, m_Target, bins, tolerance, mThreshold, mReverseThreshold);
-
- // Use the threshold to compute new support
- int s1 = GetSupportSize();
- // DD(mThreshold);
- // DD(mReverseThreshold);
- if (mThreshold > 0.0) {
- ImagePointer support1 =
- clitk::SliceBySliceRelativePosition<ImageType>(m_Support, m_Object, 2,
- mThreshold,
- m_ListOfAngles[i],false,
- false, -1, true, false);
- // writeImage<ImageType>(support1, "sup_"+toString(i)+".mha");
- // Compute the new support size
- statFilter->SetInput(support1);
- statFilter->SetLabelInput(support1);
- statFilter->Update();
- s1 = statFilter->GetCount(GetForegroundValue());
- }
-
- int s2 = GetSupportSize();
- if (mReverseThreshold < 1.0) {
- // DD(m_ListOfAngles[1]);
- ImagePointer support2 =
- clitk::SliceBySliceRelativePosition<ImageType>(m_Support, m_Object, 2,
- mReverseThreshold,
- m_ListOfAngles[i],true,
- false, -1, true, false);
- writeImage<ImageType>(support2, "sup_rev_"+toString(i)+".mha");
- // Compute the new support size
- statFilter = StatFilterType::New();
- statFilter->SetInput(support2);
- statFilter->SetLabelInput(support2);
- statFilter->Update();
- s2 = statFilter->GetCount(GetForegroundValue());
- }
-
- // Set results values
- RelativePositionInformationType r;
- r.threshold = mThreshold;
- r.sizeAfterThreshold = s1; // DD(s1);
- r.sizeBeforeThreshold = GetSupportSize();
- r.sizeReference = GetTargetSize();
- m_ListOfInformation.push_back(r);