void TransFuncEditorIntensityPet::restoreThresholds() {
    tgt::vec2 thresh = transferFuncIntensity_->getThresholds();
    resetThresholds();

    // update spinboxes
    int min = tgt::iround(thresh.x * (currentRange_.y - currentRange_.x) + currentRange_.x);
    int max = tgt::iround(thresh.y * (currentRange_.y - currentRange_.x) + currentRange_.x);

    lowerThresholdSpin_->blockSignals(true);
    lowerThresholdSpin_->setValue(min);
    lowerThresholdSpin_->blockSignals(false);
    upperThresholdSpin_->blockSignals(true);
    upperThresholdSpin_->setValue(max);
    upperThresholdSpin_->blockSignals(false);
    if (min + 1 < currentRange_.y) {
        //increment maximum of lower spin when maximum was reached and we are below upper range
        if (min == lowerThresholdSpin_->maximum())
            lowerThresholdSpin_->setMaximum(min + 1);

        //update minimum of upper spin
        upperThresholdSpin_->blockSignals(true);
        upperThresholdSpin_->setMinimum(min);
        upperThresholdSpin_->blockSignals(false);
    }

    if (max - 1 > currentRange_.x) {
        //increment minimum of upper spin when minimum was reached and we are above lower range
        if (max == upperThresholdSpin_->minimum())
            upperThresholdSpin_->setMinimum(max - 1);

        //update maximum of lower spin
        lowerThresholdSpin_->blockSignals(true);
        lowerThresholdSpin_->setMaximum(max);
        lowerThresholdSpin_->blockSignals(false);
    }

    transferFuncIntensity_->setThresholds(0.f, 1.f);
    transferFuncGradient_->setThresholds(0.f, 1.f);

    applyThreshold();

    // update doubleSlider
    doubleSlider_->blockSignals(true);
    doubleSlider_->setValues(oldThreshold_.x, oldThreshold_.y);
    doubleSlider_->setMinimalAllowedSliderDistance(1.f / static_cast<float>(currentRange_.y - currentRange_.x));
    doubleSlider_->blockSignals(false);
}
Ejemplo n.º 2
0
void TransFunc1DRampEditor::resetEditor() {
    if (property_->get() != transferFuncIntensity_) {
        LDEBUG("The pointers of property and transfer function do not match."
                << "Creating new transfer function object.....");
        transferFuncIntensity_ = new TransFunc1DKeys(maximumIntensity_ + 1);
        property_->set(transferFuncIntensity_);

        // propagate transfer function to mapping canvas and gradient
        texturePainter_->setTransFunc(transferFuncIntensity_);
        transCanvas_->setTransFunc(transferFuncIntensity_);
    }

    checkClipThresholds_->setChecked(false);
    // reset transfer function and thresholds
    resetThresholds();
    resetTransferFunction();

    causeVolumeRenderingRepaint();
}
void TransFuncEditorIntensityPet::resetEditor() {
    if (property_->get() != transferFuncIntensity_) {
        LDEBUG("The pointers of property and transfer function do not match."
                << "Creating new transfer function object.....");
        transferFuncIntensity_ = new TransFuncIntensity(maximumIntensity_ + 1);
        property_->set(transferFuncIntensity_);
        delete transferFuncGradient_;
        transferFuncGradient_ = new TransFuncIntensity(*transferFuncIntensity_);

        // propagate transfer functions to the gradients
        completeTexturePainter_->setTransFunc(transferFuncIntensity_);
        expandedTexturePainter_->setTransFunc(transferFuncGradient_);
    }

    resetTransferFunction();
    resetThresholds();

    causeVolumeRenderingRepaint();
}
Ejemplo n.º 4
0
void TransFunc1DRampEditor::clearButtonClicked() {
    resetThresholds();
    resetTransferFunction();

    causeVolumeRenderingRepaint();
}
void TransFuncEditorIntensityPet::resetButtonClicked() {
    resetTransferFunction();
    resetThresholds();

    causeVolumeRenderingRepaint();
}