std::vector<itk::Index<2> > Mask::GetHolePixelsInRegion(itk::ImageRegion<2> region) const { // Ensure the region is inside the image region.Crop(this->GetLargestPossibleRegion()); std::vector<itk::Index<2> > holePixels = GetPixelsWithValueInRegion(this, region, HoleMaskPixelTypeEnum::HOLE); return holePixels; }
std::vector<itk::Offset<2> > Mask::GetValidOffsetsInRegion(itk::ImageRegion<2> region) const { // Ensure the region is inside the image region.Crop(this->GetLargestPossibleRegion()); std::vector<itk::Index<2> > indices = GetPixelsWithValueInRegion(this, region, HoleMaskPixelTypeEnum::VALID); std::vector<itk::Offset<2> > validOffsets = IndicesToOffsets(indices, region.GetIndex()); return validOffsets; }
std::vector<itk::Index<2> > Mask::GetValidPixelsInRegion(itk::ImageRegion<2> region, const bool forward) const { // Ensure the region is inside the image region.Crop(this->GetLargestPossibleRegion()); std::vector<itk::Index<2> > validPixels = GetPixelsWithValueInRegion(this, region, HoleMaskPixelTypeEnum::VALID); if(!forward) { std::reverse(validPixels.begin( ), validPixels.end( ) ); } return validPixels; }