Exemple #1
0
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
void Application::registerProcessor(const DataModel::WaveformStreamID &wfid,
			            TimeWindowProcessor *proc) {
	registerProcessor(wfid.networkCode(),
		          wfid.stationCode(),
		          wfid.locationCode(),
		          wfid.channelCode(),
		          proc);
}
Exemple #2
0
OpenCLModule::OpenCLModule(const std::string& modulePath)
    : VoreenModule(modulePath)
    , opencl_(0)
    , context_(0)
    , queue_(0)
    //, device_(0)
    , glSharing_(true)
{
    setName("OpenCL");
    instance_ = this;

    registerProcessor(new DynamicCLProcessor());
    registerProcessor(new GrayscaleCL());
    registerProcessor(new RaycasterCL());
    registerProcessor(new RaytracingEntryExitPoints());
    registerProcessor(new VolumeGradientCL());
}
Exemple #3
0
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
void Application::registerProcessor(const std::string& networkCode,
                                    const std::string& stationCode,
                                    const std::string& locationCode,
                                    const std::string& channelCode,
                                    TimeWindowProcessor *twp) {
	registerProcessor(networkCode, stationCode, locationCode, channelCode, (WaveformProcessor*)twp);

	twp->computeTimeWindow();

	RecordSequence* seq = _waveformBuffer.sequence(
		StreamBuffer::WaveformID(networkCode, stationCode, locationCode, channelCode));
	if ( !seq ) return;

	Core::Time startTime = twp->timeWindow().startTime() - twp->margin();
	Core::Time endTime = twp->timeWindow().endTime() +  twp->margin();

	if ( startTime < seq->timeWindow().startTime() ) {
		// TODO: Fetch historical data
		// Actually feed as much data as possible
		TimeWindowProcessorPtr twp_ptr = twp;

		for ( RecordSequence::iterator it = seq->begin(); it != seq->end(); ++it ) {
			if ( (*it)->startTime() > endTime )
				break;
			twp->feed((*it).get());
		}
	}
	else {
		// find the position in the recordsequence to fill the requested timewindow
		RecordSequence::reverse_iterator rit;
		for ( rit = seq->rbegin(); rit != seq->rend(); ++rit ) {
			if ( (*rit)->endTime() < startTime )
				break;
		}

		RecordSequence::iterator it;
		if ( rit == seq->rend() )
			it = seq->begin();
		else
			it = --rit.base();

		while ( it != seq->end() && (*it)->startTime() <= endTime ) {
			twp->feed((*it).get());
			++it;
		}
	}

	if ( twp->isFinished() ) {
		processorFinished(twp->lastRecord(), twp);
		removeProcessor(twp);
	}
}
Exemple #4
0
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
void Application::addProcessor(const std::string& networkCode,
                               const std::string& stationCode,
                               const std::string& locationCode,
                               const std::string& channelCode,
                               TimeWindowProcessor *twp) {
	if ( _registrationBlocked ) {
		_timeWindowProcessorQueue.push_back(
			TimeWindowProcessorItem(WID(networkCode, stationCode,
			                            locationCode, channelCode, ""), twp))
		;
		return;
	}

	registerProcessor(networkCode, stationCode,
	                  locationCode, channelCode, twp);
}
Exemple #5
0
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
void Application::addProcessor(const std::string& networkCode,
                               const std::string& stationCode,
                               const std::string& locationCode,
                               const std::string& channelCode,
                               WaveformProcessor *wp) {
	if ( _registrationBlocked ) {
		_waveformProcessorQueue.push_back(
			WaveformProcessorItem(WID(networkCode, stationCode,
			                          locationCode, channelCode, ""), wp))
		;
		return;
	}

	registerProcessor(networkCode, stationCode,
	                  locationCode, channelCode, wp);
}
ITK_GENERATEDModule::ITK_GENERATEDModule(const std::string& modulePath)
    : VoreenModule(modulePath)
{
    setName("ITK_GENERATED");

    registerProcessor(new CurvatureAnisotropicDiffusionImageFilterITK());
    registerProcessor(new GradientAnisotropicDiffusionImageFilterITK());
    registerProcessor(new VectorCurvatureAnisotropicDiffusionImageFilterITK());
    registerProcessor(new VectorGradientAnisotropicDiffusionImageFilterITK());
    registerProcessor(new AntiAliasBinaryImageFilterITK());
    registerProcessor(new BinaryDilateImageFilterITK());
    registerProcessor(new BinaryErodeImageFilterITK());
    registerProcessor(new BinaryMorphologicalClosingImageFilterITK());
    registerProcessor(new BinaryMorphologicalOpeningImageFilterITK());
    registerProcessor(new BinaryPruningImageFilterITK());
    registerProcessor(new DilateObjectMorphologyImageFilterITK());
    registerProcessor(new ErodeObjectMorphologyImageFilterITK());
    registerProcessor(new ConnectedComponentImageFilterITK());
    registerProcessor(new HardConnectedComponentImageFilterITK());
    registerProcessor(new RelabelComponentImageFilterITK());
    registerProcessor(new ScalarConnectedComponentImageFilterITK());
    registerProcessor(new ThresholdMaximumConnectedComponentsImageFilterITK());
    registerProcessor(new CurvatureFlowImageFilterITK());
    registerProcessor(new MinMaxCurvatureFlowImageFilterITK());
    registerProcessor(new ContourDirectedMeanDistanceImageFilterITK());
    registerProcessor(new ContourMeanDistanceImageFilterITK());
    registerProcessor(new DanielssonDistanceMapImageFilterITK());
    registerProcessor(new DirectedHausdorffDistanceImageFilterITK());
    registerProcessor(new HausdorffDistanceImageFilterITK());
    registerProcessor(new SignedDanielssonDistanceMapImageFilterITK());
    registerProcessor(new AbsoluteValueDifferenceImageFilterITK());
    registerProcessor(new CheckerBoardImageFilterITK());
    registerProcessor(new SimilarityIndexImageFilterITK());
    registerProcessor(new SquaredDifferenceImageFilterITK());
    registerProcessor(new CannyEdgeDetectionImageFilterITK());
    registerProcessor(new DerivativeImageFilterITK());
    registerProcessor(new LaplacianImageFilterITK());
    registerProcessor(new LaplacianRecursiveGaussianImageFilterITK());
    registerProcessor(new LaplacianSharpeningImageFilterITK());
    registerProcessor(new SimpleContourExtractorImageFilterITK());
    registerProcessor(new SobelEdgeDetectionImageFilterITK());
    registerProcessor(new ZeroCrossingBasedEdgeDetectionImageFilterITK());
    registerProcessor(new ZeroCrossingImageFilterITK());
    registerProcessor(new LabelOverlayImageFilterITK());
    registerProcessor(new LabelToRGBImageFilterITK());
    registerProcessor(new GradientImageFilterITK());
    registerProcessor(new GradientMagnitudeImageFilterITK());
    registerProcessor(new GradientMagnitudeRecursiveGaussianImageFilterITK());
    registerProcessor(new GradientRecursiveGaussianImageFilterITK());
    registerProcessor(new VectorGradientMagnitudeImageFilterITK());
    registerProcessor(new AbsImageFilterITK());
    registerProcessor(new AcosImageFilterITK());
    registerProcessor(new AddImageFilterITK());
    registerProcessor(new AndImageFilterITK());
    registerProcessor(new AsinImageFilterITK());
    registerProcessor(new Atan2ImageFilterITK());
    registerProcessor(new AtanImageFilterITK());
    registerProcessor(new BinaryMagnitudeImageFilterITK());
    registerProcessor(new BoundedReciprocalImageFilterITK());
    registerProcessor(new ConstrainedValueAdditionImageFilterITK());
    registerProcessor(new ConstrainedValueDifferenceImageFilterITK());
    registerProcessor(new CosImageFilterITK());
    registerProcessor(new DivideImageFilterITK());
    registerProcessor(new EdgePotentialImageFilterITK());
    registerProcessor(new ExpImageFilterITK());
    registerProcessor(new ExpNegativeImageFilterITK());
    registerProcessor(new IntensityWindowingImageFilterITK());
    registerProcessor(new InvertIntensityImageFilterITK());
    registerProcessor(new Log10ImageFilterITK());
    registerProcessor(new LogImageFilterITK());
    registerProcessor(new MaskImageFilterITK());
    registerProcessor(new MaximumImageFilterITK());
    registerProcessor(new MinimumImageFilterITK());
    registerProcessor(new ModulusImageFilterITK());
    registerProcessor(new MultiplyImageFilterITK());
    registerProcessor(new NotImageFilterITK());
    registerProcessor(new OrImageFilterITK());
    registerProcessor(new RescaleIntensityImageFilterITK());
    registerProcessor(new ShiftScaleImageFilterITK());
    registerProcessor(new SigmoidImageFilterITK());
    registerProcessor(new SinImageFilterITK());
    registerProcessor(new SqrtImageFilterITK());
    registerProcessor(new SquareImageFilterITK());
    registerProcessor(new SubtractImageFilterITK());
    registerProcessor(new TanImageFilterITK());
    registerProcessor(new TernaryAddImageFilterITK());
    registerProcessor(new TernaryMagnitudeImageFilterITK());
    registerProcessor(new TernaryMagnitudeSquaredImageFilterITK());
    registerProcessor(new WeightedAddImageFilterITK());
    registerProcessor(new XorImageFilterITK());
    registerProcessor(new BinaryContourImageFilterITK());
    registerProcessor(new LabelContourImageFilterITK());
    registerProcessor(new AccumulateImageFilterITK());
    registerProcessor(new AdaptiveHistogramEqualizationImageFilterITK());
    registerProcessor(new GetAverageSliceImageFilterITK());
    registerProcessor(new MinimumMaximumImageFilterITK());
    registerProcessor(new BinaryMedianImageFilterITK());
    registerProcessor(new LabelVotingImageFilterITK());
    registerProcessor(new VotingBinaryHoleFillingImageFilterITK());
    registerProcessor(new VotingBinaryIterativeHoleFillingImageFilterITK());
    registerProcessor(new CurvesLevelSetImageFilterITK());
    registerProcessor(new GeodesicActiveContourLevelSetImageFilterITK());
    registerProcessor(new GeodesicActiveContourShapePriorLevelSetImageFilterITK());
    registerProcessor(new NarrowBandCurvesLevelSetImageFilterITK());
    registerProcessor(new NarrowBandThresholdSegmentationLevelSetImageFilterITK());
    registerProcessor(new ShapeDetectionLevelSetImageFilterITK());
    registerProcessor(new BasicDilateImageFilterITK());
    registerProcessor(new BasicErodeImageFilterITK());
    registerProcessor(new BlackTopHatImageFilterITK());
    registerProcessor(new ClosingByReconstructionImageFilterITK());
    registerProcessor(new DoubleThresholdImageFilterITK());
    registerProcessor(new GrayscaleConnectedClosingImageFilterITK());
    registerProcessor(new GrayscaleConnectedOpeningImageFilterITK());
    registerProcessor(new GrayscaleDilateImageFilterITK());
    registerProcessor(new GrayscaleErodeImageFilterITK());
    registerProcessor(new GrayscaleFillholeImageFilterITK());
    registerProcessor(new GrayscaleFunctionDilateImageFilterITK());
    registerProcessor(new GrayscaleFunctionErodeImageFilterITK());
    registerProcessor(new GrayscaleGeodesicDilateImageFilterITK());
    registerProcessor(new GrayscaleGeodesicErodeImageFilterITK());
    registerProcessor(new GrayscaleGrindPeakImageFilterITK());
    registerProcessor(new GrayscaleMorphologicalClosingImageFilterITK());
    registerProcessor(new GrayscaleMorphologicalOpeningImageFilterITK());
    registerProcessor(new HConcaveImageFilterITK());
    registerProcessor(new HConvexImageFilterITK());
    registerProcessor(new HMaximaImageFilterITK());
    registerProcessor(new HMinimaImageFilterITK());
    registerProcessor(new MorphologicalGradientImageFilterITK());
    registerProcessor(new MovingHistogramDilateImageFilterITK());
    registerProcessor(new MovingHistogramErodeImageFilterITK());
    registerProcessor(new MovingHistogramMorphologicalGradientImageFilterITK());
    registerProcessor(new OpeningByReconstructionImageFilterITK());
    registerProcessor(new ReconstructionByDilationImageFilterITK());
    registerProcessor(new ReconstructionByErosionImageFilterITK());
    registerProcessor(new WhiteTopHatImageFilterITK());
    registerProcessor(new ConfidenceConnectedImageFilterITK());
    registerProcessor(new ConnectedThresholdImageFilterITK());
    registerProcessor(new IsolatedConnectedImageFilterITK());
    registerProcessor(new NeighborhoodConnectedImageFilterITK());
    registerProcessor(new BinomialBlurImageFilterITK());
    registerProcessor(new DiscreteGaussianImageFilterITK());
    registerProcessor(new MeanImageFilterITK());
    registerProcessor(new MedianImageFilterITK());
    registerProcessor(new RecursiveGaussianImageFilterITK());
    registerProcessor(new SmoothingRecursiveGaussianImageFilterITK());
    registerProcessor(new BinaryThresholdImageFilterITK());
    registerProcessor(new OtsuMultipleThresholdsImageFilterITK());
    registerProcessor(new OtsuThresholdImageFilterITK());
    registerProcessor(new ThresholdImageFilterITK());
    registerProcessor(new IsolatedWatershedImageFilterITK());

}
Exemple #7
0
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
void Application::handleRecord(Record *rec) {
	std::string streamID = rec->streamID();
	std::list<WaveformProcessor*> trashList;

	RecordPtr tmp(rec);

	if ( rec->data() == NULL ) return;

	if ( !_waveformBuffer.feed(rec) ) return;

	if ( _waveformBuffer.addedNewStream() )
		handleNewStream(rec);

	_registrationBlocked = true;

	std::pair<ProcessorMap::iterator, ProcessorMap::iterator> itq = _processors.equal_range(streamID);
	for ( ProcessorMap::iterator it = itq.first; it != itq.second; ++it ) {
		// The proc must not be already on the removal list
		if ( std::find(_waveformProcessorRemovalQueue.begin(),
		               _waveformProcessorRemovalQueue.end(),
		               it->second) != _waveformProcessorRemovalQueue.end() )
			continue;

		// Schedule the processor for deletion when finished
		if ( it->second->isFinished() )
			trashList.push_back(it->second.get());
		else {
			it->second->feed(rec);
			if ( it->second->isFinished() )
				trashList.push_back(it->second.get());
		}
	}

	// Delete finished processors
	for ( std::list<WaveformProcessor*>::iterator itt = trashList.begin();
	      itt != trashList.end(); ++itt ) {
		processorFinished(rec, *itt);
		removeProcessor(*itt);
	}

	trashList.clear();

	_registrationBlocked = false;

	// Remove outdated processors if not already on the trash list
	while ( !_waveformProcessorRemovalQueue.empty() ) {
		WaveformProcessorPtr wp = _waveformProcessorRemovalQueue.front();
		_waveformProcessorRemovalQueue.pop_front();
		removeProcessor(wp.get());
	}

	// Register pending processors
	while ( !_waveformProcessorQueue.empty() ) {
		WID wid = _waveformProcessorQueue.front().first;
		WaveformProcessorPtr wp = _waveformProcessorQueue.front().second;
		_waveformProcessorQueue.pop_front();

		registerProcessor(wid.networkCode(), wid.stationCode(),
		                  wid.locationCode(), wid.channelCode(), wp.get());
	}

	while ( !_timeWindowProcessorQueue.empty() ) {
		WID wid = _timeWindowProcessorQueue.front().first;
		TimeWindowProcessorPtr twp = _timeWindowProcessorQueue.front().second;
		_timeWindowProcessorQueue.pop_front();

		registerProcessor(wid.networkCode(), wid.stationCode(),
		                  wid.locationCode(), wid.channelCode(), twp.get());
	}
}