int main(int argc, char** argv) { try { util::ProgramOptions::init(argc, argv); logger::LogManager::init(); pipeline::Process<ImageStackDirectoryReader> intensityReader(optionIntensities.as<std::string>()); pipeline::Process<ImageStackDirectoryReader> labelReader(optionLabels.as<std::string>()); pipeline::Value<ImageStack> intensityStack = intensityReader->getOutput(); pipeline::Value<ImageStack> labelStack = labelReader->getOutput(); if (optionExtractLabels) { LOG_DEBUG(logger::out) << "[main] extracting labels from connected components" << std::endl; pipeline::Process<ExtractLabels> extractLabels; extractLabels->setInput(labelReader->getOutput()); labelStack = extractLabels->getOutput(); } unsigned int width = labelStack->width(); unsigned int height = labelStack->height(); unsigned int depth = labelStack->size(); if (width != intensityStack->width() || height != intensityStack->height() || depth != intensityStack->size()) UTIL_THROW_EXCEPTION( UsageError, "intensity and label stacks have different sizes"); // create volumes from stacks ExplicitVolume<float> intensities(*intensityStack); ExplicitVolume<int> labels(*labelStack); intensities.normalize(); // store them in the project file boost::filesystem::remove(optionProjectFile.as<std::string>()); Hdf5VolumeStore volumeStore(optionProjectFile.as<std::string>()); volumeStore.saveIntensities(intensities); volumeStore.saveLabels(labels); } catch (boost::exception& e) { handleException(e, std::cerr); } }
std::pair<int,double> LeastRecentlyUsedCache::getIntensity(int frameLow, int frameHigh, double percentile ){ std::pair<int,double> intensities( -1, 0 ); int position = 0; for ( QLinkedList<LeastRecentlyUsedCacheEntry>::iterator iter = m_cache.begin(); iter != m_cache.end(); iter++ ){ if ( (*iter).getFrameLow() == frameLow ){ if ( (*iter).getFrameHigh() == frameHigh ){ if ( qAbs( percentile - (*iter).getPercentile() )< ERROR_MARGIN ){ intensities.first = (*iter).getLocation(); intensities.second = (*iter).getIntensity(); _refresh(position); break; } } } position++; } return intensities; }