本文整理汇总了C++中ImageList::remove方法的典型用法代码示例。如果您正苦于以下问题:C++ ImageList::remove方法的具体用法?C++ ImageList::remove怎么用?C++ ImageList::remove使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ImageList
的用法示例。
在下文中一共展示了ImageList::remove方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PruneImages
//.........这里部分代码省略.........
if ( x > left_crop && (x+tile_size) < right_crop )
continue;
for (unsigned int y = 0, yid = 0; y < image_size[1]; y += tile_size, yid++)
{
if ( y > top_crop && (y+tile_size) < bottom_crop )
continue;
image_t::RegionType chunk_region;
image_t::IndexType chunk_index;
chunk_index[0] = x + image_index[0];
chunk_index[1] = y + image_index[1];
chunk_region.SetIndex( chunk_index );
chunk_size[0] = std::min(tile_size, static_cast<unsigned int>(image_size[0] - x));
chunk_size[1] = std::min(tile_size, static_cast<unsigned int>(image_size[1] - y));
chunk_region.SetSize( chunk_size );
image_t::IndexType index;
typedef itk::ImageRegionIteratorWithIndex<image_t> iter_t;
iter_t iter(image, chunk_region);
// Find the average intensity on this chunk.
double avg = 0.0, count = 0.0;
for (iter.GoToBegin(); !iter.IsAtEnd(); ++iter)
{
index = iter.GetIndex();
double pixel_value = image->GetPixel(index);
avg += pixel_value;
count += 1.0;
full_count += 1.0;
}
avg /= count;
// Find how far each value is from the average.
for (iter.GoToBegin(); !iter.IsAtEnd(); ++iter)
{
index = iter.GetIndex();
double pixel_value = image->GetPixel(index);
interest_level += std::abs(pixel_value - avg);
}
}
}
double interest = (interest_level / full_count);
if ( interest < min_interest )
min_interest = interest;
if ( interest > max_interest )
max_interest = interest;
if ( transform.size() != 0 )
{
// Save out those that passed the test.
if ( interest > intensity_tolerance )
{
std::cout << "Passed the test with " << interest << ": " << (*fn_iter) << std::endl;
passed.push_back((*fn_iter));
}
else
{
std::cout << "Failed the test " << interest << ": " << (*fn_iter) << std::endl;
failed.push_back((*fn_iter));
if ( transform.size() > i )
transform.erase(transform.begin()+i,transform.begin()+i+1);
i--;
}
}
else
std::cout << (*fn_iter) << ": " << interest << std::endl;
interest_level = 0.0;
}
if ( transform.size() != 0 )
{
std::cout << "Images that passed:" << std::endl;
for (ImageList::const_iterator fn_iter = passed.begin();
fn_iter != passed.end(); ++fn_iter)
{
std::cout << " " << (*fn_iter) << std::endl;
}
std::cout << std::endl << "Images that failed:" << std::endl;
for (ImageList::const_iterator fn_iter = failed.begin(); fn_iter != failed.end(); ++fn_iter)
{
std::cout << " " << (*fn_iter) << std::endl;
image_names.remove( *fn_iter );
}
if ( min_interest > intensity_tolerance )
{
std::cout << "No images were pruned. "
<< "To prune an image, a tolerance of at least: "
<< min_interest << " is needed." << std::endl;
}
}
}