void Image::internalUpdate() { Q_ASSERT(myLockStatus() == KstRWLock::WRITELOCKED); writeLockInputsAndOutputs(); if (_inputMatrices.contains(THEMATRIX)) { MatrixPtr mp = _inputMatrices[THEMATRIX]; // stats NS = mp->sampleCount(); MinX = mp->minX(); int xNumSteps = mp->xNumSteps(); double xStepSize = mp->xStepSize(); MaxX = xNumSteps*xStepSize + MinX; MinY = mp->minY(); int yNumSteps = mp->yNumSteps(); double yStepSize = mp->yStepSize(); MaxY = yNumSteps*yStepSize + MinY; _ns_maxx = MaxX; _ns_minx = MinX; _ns_maxy = MaxY; _ns_miny = MinY; MinPosY = MinY > 0 ? MinY : yStepSize*0.5; MinPosX = MinX > 0 ? MinX : xStepSize*0.5; //recalculate the thresholds if necessary if (_autoThreshold) { _zLower = mp->minValue(); _zUpper = mp->maxValue(); } //update the contour lines if (hasContourMap()) { double min = mp->minValue(), max = mp->maxValue(); double contourStep = (max - min) / (double)(_numContourLines + 1); if (contourStep > 0) { _contourLines.clear(); for (int i = 0; i < _numContourLines; i++) { _contourLines.append(min + (i+1) * contourStep); } } } _redrawRequired = true; } unlockInputsAndOutputs(); return; }
void ImageTab::calculateAutoThreshold() { MatrixPtr matrix = _matrix->selectedMatrix(); if (matrix) { matrix->readLock(); _lowerThreshold->setText(QString::number(matrix->minValue())); _upperThreshold->setText(QString::number(matrix->maxValue())); matrix->unlock(); } }