Beispiel #1
0
void
SegmentsPainter::draw(const ContinuationSegment& continuation) {

	glCheck(glEnable(GL_TEXTURE_2D));

	drawSlice(continuation.getSourceSlice(), 0.5, 1.0, 0.5);
	drawSlice(continuation.getTargetSlice(), 0.5, 1.0, 0.5);

	util::point<double> center1 = continuation.getSourceSlice()->getComponent()->getCenter();
	util::point<double> center2 = continuation.getTargetSlice()->getComponent()->getCenter();

	unsigned int section1 = continuation.getSourceSlice()->getSection();
	unsigned int section2 = continuation.getTargetSlice()->getSection();

	glCheck(glDisable(GL_TEXTURE_2D));

	glBegin(GL_LINES);

	glCheck(glVertex3f(center1.x, center1.y, section1*_zScale));
	glCheck(glVertex3f(center2.x, center2.y, section2*_zScale));

	glCheck(glEnd());

	glBegin(GL_POINTS);

	glCheck(glVertex3f(center1.x, center1.y, section1*_zScale));
	glCheck(glVertex3f(center2.x, center2.y, section2*_zScale));

	glCheck(glEnd());
}
void
GeometryFeatureExtractor::computeFeatures(const ContinuationSegment& continuation, std::vector<double>& features) {

	const util::point<double>& sourceCenter = continuation.getSourceSlice()->getComponent()->getCenter();
	const util::point<double>& targetCenter = continuation.getTargetSlice()->getComponent()->getCenter();

	unsigned int sourceSize = continuation.getSourceSlice()->getComponent()->getSize();
	unsigned int targetSize = continuation.getTargetSlice()->getComponent()->getSize();

	util::point<double> difference = sourceCenter - targetCenter;

	double distance = difference.x*difference.x + difference.y*difference.y;

	double setDifference = _setDifference(*continuation.getSourceSlice(), *continuation.getTargetSlice(), false, false);

	double setDifferenceRatio = setDifference/(sourceSize + targetSize);

	double alignedSetDifference = _setDifference(*continuation.getSourceSlice(), *continuation.getTargetSlice(), false, true);

	double alignedSetDifferenceRatio = setDifference/(sourceSize + targetSize);

	double overlap = _overlap(*continuation.getSourceSlice(), *continuation.getTargetSlice());

	double overlapRatio = overlap/(sourceSize + targetSize - overlap);

	double alignedOverlap = _alignedOverlap(*continuation.getSourceSlice(), *continuation.getTargetSlice());

	double alignedOverlapRatio = alignedOverlap/(sourceSize + targetSize - overlap);

	features[0] = distance;
	features[1] = setDifference;
	features[2] = setDifferenceRatio;
	features[3] = alignedSetDifference;
	features[4] = alignedSetDifferenceRatio;
	features[5] =
			(continuation.getSourceSlice()->getComponent()->getSize() +
			 continuation.getTargetSlice()->getComponent()->getSize())*0.5;
	features[6] = overlap;
	features[7] = overlapRatio;
	features[8] = alignedOverlap;
	features[9] = alignedOverlapRatio;

	if (!_noSliceDistance) {

		double averageSliceDistance, maxSliceDistance;

		_distance(*continuation.getSourceSlice(), *continuation.getTargetSlice(), true, false, averageSliceDistance, maxSliceDistance);

		double alignedAverageSliceDistance, alignedMaxSliceDistance;

		_distance(*continuation.getSourceSlice(), *continuation.getTargetSlice(), true, true, alignedAverageSliceDistance, alignedMaxSliceDistance);

		features[10] = averageSliceDistance;
		features[11] = maxSliceDistance;
		features[12] = alignedAverageSliceDistance;
		features[13] = alignedMaxSliceDistance;
	}
}
void
HistogramFeatureExtractor::getFeatures(const ContinuationSegment& continuation, std::vector<double>& features) {

	std::vector<double> sourceHistogram = computeHistogram(*continuation.getSourceSlice().get());
	std::vector<double> targetHistogram = computeHistogram(*continuation.getTargetSlice().get());

	for (unsigned int i = 0; i < _numBins; i++)
		features[2*_numBins + i] = std::abs(sourceHistogram[i] - targetHistogram[i]);

	double sourceSum = 0;
	double targetSum = 0;
	for (unsigned int i = 0; i < _numBins; i++) {

		sourceSum += sourceHistogram[i];
		targetSum += targetHistogram[i];
	}

	for (unsigned int i = 0; i < _numBins; i++)
		features[2*_numBins + _numBins + i] = std::abs(sourceHistogram[i]/sourceSum - targetHistogram[i]/targetSum);
}
Beispiel #4
0
void
SegmentsPainter::loadTextures(const ContinuationSegment& continuation) {

	loadTexture(*continuation.getSourceSlice());
	loadTexture(*continuation.getTargetSlice());
}