本文整理汇总了C++中ImageList::push_back方法的典型用法代码示例。如果您正苦于以下问题:C++ ImageList::push_back方法的具体用法?C++ ImageList::push_back怎么用?C++ ImageList::push_back使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ImageList
的用法示例。
在下文中一共展示了ImageList::push_back方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
mitk::TestDICOMLoading::ImageList
mitk::TestDICOMLoading
::LoadFiles( const StringList& files )
{
for (auto iter = files.begin();
iter != files.end();
++iter)
{
MITK_DEBUG << "File " << *iter;
}
ImageList result;
ClassicDICOMSeriesReader::Pointer reader = this->BuildDICOMReader();
reader->SetInputFiles( files );
reader->AnalyzeInputFiles();
reader->PrintOutputs(std::cout,true);
reader->LoadImages();
unsigned int numberOfImages = reader->GetNumberOfOutputs();
for (unsigned imageIndex = 0; imageIndex < numberOfImages; ++imageIndex)
{
const DICOMImageBlockDescriptor& block = reader->GetOutput(imageIndex);
result.push_back( block.GetMitkImage() );
}
return result;
}
示例2:
mitk::TestDICOMLoading::ImageList mitk::TestDICOMLoading::LoadFiles( const StringContainer& files )
{
for (StringContainer::const_iterator iter = files.begin();
iter != files.end();
++iter)
{
MITK_DEBUG << "File " << *iter;
}
ImageList result;
DicomSeriesReader::FileNamesGrouping seriesInFiles = DicomSeriesReader::GetSeries( files, true );
// TODO sort series UIDs, implementation of map iterator might differ on different platforms (or verify this is a standard topic??)
for (DicomSeriesReader::FileNamesGrouping::const_iterator seriesIter = seriesInFiles.begin();
seriesIter != seriesInFiles.end();
++seriesIter)
{
StringContainer files = seriesIter->second.GetFilenames();
DataNode::Pointer node = DicomSeriesReader::LoadDicomSeries( files );
if (node.IsNotNull())
{
Image::Pointer image = dynamic_cast<mitk::Image*>( node->GetData() );
result.push_back( image );
}
else
{
}
}
return result;
}
示例3: LoadPreprocessedFiles
static ImageList LoadPreprocessedFiles(FileList files)
{
ImageList images;
for (unsigned int i=0; i < files.size() ; ++i)
{
images.push_back(mitk::IOUtil::LoadImage(files.at(i)));
}
return images;
}
示例4: RunTask
void Pipeline::RunTask(Task* task)
{
// Get list of all filenames in task
QStringList allFilenames = task->GetAllFilenames();
// Load all source images
ImageList sourceImages;
for(QString filename : allFilenames)
{
QFileInfo fileInfo(filename);
QImage image(filename);
sourceImages.push_back(QPair<QString,QImage>(fileInfo.completeBaseName(), image));
}
if(task->resize) ResizeStage(sourceImages, task);
else
{
QHash<QString,ImageList> images;
images[QString::null] = sourceImages;
BuildAtlasStage(images, task);
}
}
示例5: CurrentImage
Img::Image::Ptr Cacher::apply_priorities(bool flip) {
Img::Image::Ptr image = CurrentImage();
// Highest priority on current, higher on next, high on prev, medium on next-next, minimum on prev-prev.
ImageList newQueue;
newQueue.push_back(WorkRequest(image.get(), CurrentImageFilename()));
if (flip == false) {
attemptPush(newQueue, PeekRelativeRequest(1));
attemptPush(newQueue, PeekRelativeRequest(-1));
attemptPush(newQueue, PeekRelativeRequest(2));
attemptPush(newQueue, PeekRelativeRequest(-2));
}
else {
attemptPush(newQueue, PeekRelativeRequest(-1));
attemptPush(newQueue, PeekRelativeRequest(1));
attemptPush(newQueue, PeekRelativeRequest(-2));
attemptPush(newQueue, PeekRelativeRequest(2));
}
m_decThread->CacheImage(newQueue);
return image;
}
示例6: vtkPaving
// makes a new paving from a vtk file
// expects 3d, structured point data in file
SPMinimalnode* SPMinimalnode::vtkPaving(const std::string filename)
{
SPMinimalnode* newTree = NULL;
try {
size_t expectedDims = 3;
IntVec Xs;
IntVec Ys;
IntVec Zs;
// get the spacing and fill in the coordinates vectors using
// getCoordinatesFromVtk.
// getCoordinatesFromVtk expects 10 header lines with spacings on 4th
IntVec spacing = getCoordinatesFromVtk(Xs, Ys, Zs, filename);
bool success = ((spacing.size() == expectedDims) && (spacing[0] > 0)
&& (spacing[0] == spacing[1])
&& (spacing[0] == spacing[2]));
if (success) {
ivector rootbox(expectedDims);
double maxXYZ = spacing[0] * 1.0;
ImageList boxes;
double totalListVol = 0;
IntVecItr xIt = Xs.begin();
IntVecItr yIt = Ys.begin();
IntVecItr zIt = Zs.begin();
for (xIt = Xs.begin(); xIt < Xs.end(); xIt++, yIt++, zIt++) {
ivector box(expectedDims);
// make the box so that its boundaries are on the inner edges
// of the voxel
interval xdim(Sup(_interval(*xIt/maxXYZ)),
Inf(_interval(*xIt + 1.0)/maxXYZ));
interval ydim(Sup(_interval(*yIt/maxXYZ)),
Inf(_interval(*yIt + 1.0)/maxXYZ));
interval zdim(Sup(_interval(*zIt/maxXYZ)),
Inf(_interval(*zIt + 1.0)/maxXYZ));
box[1] = xdim;
box[2] = ydim;
box[3] = zdim;
boxes.push_back(box);
totalListVol += Volume(box);
}
rootbox[1] = interval(0.0, 1.0);
rootbox[2] = interval(0.0, 1.0);
rootbox[3] = interval(0.0, 1.0);
newTree = makeTreeFromVoxels(rootbox, boxes,
maxXYZ, expectedDims);
}
if (newTree != NULL) {
newTree->setNodeName("X");
newTree->recursiveRename();
}
return newTree;
}
catch(std::exception const& e) {
delete newTree;
newTree = NULL;
throw;
}
}
示例7: attemptPush
void attemptPush(ImageList& queue, WorkRequest newRequest) {
if (std::find(queue.begin(), queue.end(), newRequest) == queue.end()) {
queue.push_back(newRequest);
}
}
示例8: 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;
}
}
}