// LCOV_EXCL_START
// this operator was designed for completeness but is not currently used
// Compare two reference lists.  If they are equal, return true.
// Otherwise, return false. Comparision stops at first non-match.
NABoolean MdamRefList::operator==(const MdamRefList & otherList) const
{
  // Obtain the first disjunct number from each list.
  Int32 thisDisjunctNum = disjunctNumInitialValue;
  Int32 otherDisjunctNum = disjunctNumInitialValue;
  MdamRefListIterator thisIterator(this);
  MdamRefListIterator otherIterator(&otherList); 
  NABoolean thisMore = thisIterator(thisDisjunctNum);
  NABoolean otherMore = otherIterator(otherDisjunctNum);  
  // Compare disjunct numbers.  Stop when either list is exhausted
  while (thisMore && otherMore)
    {
      if (thisDisjunctNum == otherDisjunctNum)
        {
          // Disjunct numbers the same.  Advance both lists.
          thisMore  = thisIterator(thisDisjunctNum);
          otherMore = otherIterator(otherDisjunctNum);
        }
      else 
        {
          // Disjunct numbers differ.  So, return false.
          return FALSE;
        }
    }
  // Check if either list has additional entries.  If so, return false.
  if (thisMore || otherMore) return FALSE;
  // Lists must be equal so return true.
  return TRUE;
}
// Determine if the intersection of two reference lists is empty.
NABoolean MdamRefList::intersectEmpty(const MdamRefList & otherList)
{
  // Obtain the first disjunct number from each list.
  Int32 thisDisjunctNum = disjunctNumInitialValue;
  Int32 otherDisjunctNum = disjunctNumInitialValue;
  MdamRefListIterator thisIterator(this);
  MdamRefListIterator otherIterator(&otherList); 
  NABoolean thisMore  = thisIterator(thisDisjunctNum);
  NABoolean otherMore = otherIterator(otherDisjunctNum);
  
  // Loop looking for a disjunct number common to both lists.
  // Stop when such a disjunct number is found or when
  // either list is exhausted.
  while (thisMore && otherMore)
    {
      if (thisDisjunctNum == otherDisjunctNum)
        {
          // Match!  Return false because the intersection is not empty.
          return FALSE;
        }
      else if (thisDisjunctNum < otherDisjunctNum)
        {
          // Disjunct number from this list is less.
          // Advance this list.
          thisMore = thisIterator(thisDisjunctNum);
        }
      else
        {
          // Disjunct number from otherList is less.
          // Advance otherList.
          otherMore = otherIterator(otherDisjunctNum);
        }
    }
  return TRUE;  // Return true because the intersection is empty.
}
void Mask::CopyHolesFrom(const Mask* const inputMask)
{
  itk::ImageRegionConstIterator<Mask> inputIterator(inputMask, inputMask->GetLargestPossibleRegion());
  itk::ImageRegionIterator<Mask> thisIterator(this, this->GetLargestPossibleRegion());

  while(!inputIterator.IsAtEnd())
  {
    if(inputMask->IsHole(inputIterator.GetIndex()))
    {
      thisIterator.Set(HoleMaskPixelTypeEnum::HOLE);
    }
    ++inputIterator;
    ++thisIterator;
  }
}
Exemple #4
0
void Mask::DeepCopyFrom(const Mask* inputMask)
{
  this->SetRegions(inputMask->GetLargestPossibleRegion());
  this->Allocate();

  itk::ImageRegionConstIterator<Mask> inputIterator(inputMask, inputMask->GetLargestPossibleRegion());
  itk::ImageRegionIterator<Mask> thisIterator(this, this->GetLargestPossibleRegion());

  while(!inputIterator.IsAtEnd())
    {
    thisIterator.Set(inputIterator.Get());
    ++inputIterator;
    ++thisIterator;
    }
  this->SetHoleValue(inputMask->GetHoleValue());
  this->SetValidValue(inputMask->GetValidValue());
}
void Mask::CreateValidPixelsFromValue(const TImage* const inputImage,
                                      const typename TImage::PixelType value)
{
  assert(inputImage->GetLargestPossibleRegion() == this->GetLargestPossibleRegion());

  itk::ImageRegionConstIterator<TImage> inputIterator(inputImage, inputImage->GetLargestPossibleRegion());
  itk::ImageRegionIterator<Mask> thisIterator(this, this->GetLargestPossibleRegion());

  while(!inputIterator.IsAtEnd())
  {
    if(inputIterator.Get() == value)
    {
      thisIterator.Set(HoleMaskPixelTypeEnum::VALID);
    }
    ++inputIterator;
    ++thisIterator;
  }
}