DoubleRange DoublePropertyImageTFDataWindow::getValueRange() const { if (!mImage) return DoubleRange(); double range = mImage->getMax() - mImage->getMin(); return DoubleRange(1,range,range/1000.0); }
DoubleRange DoublePropertyImageTFDataAlpha::getValueRange() const { if (!mImageTFData) return DoubleRange(); double max = 1.0; return DoubleRange(0,max,max/100.0); }
DoubleRange DoublePropertyImageTFDataLevel::getValueRange() const { if (!mImageTFData) return DoubleRange(); double max = mImage->getMax(); double min = mImage->getMin(); return DoubleRange(min,max,1); }
DoubleRange DoublePropertyImageTFDataLLR::getValueRange() const { if (!mImageTFData) return DoubleRange(); double max = mImage->getMax(); double min = mImage->getMin(); //Set range to min - 1 to allow an llr that shows all values return DoubleRange(min - 1,max,(max-min)/1000.0); }
void BronchoscopyRegistrationWidget::createMaxLocalRegistrationDistance(QDomElement root) { mMaxLocalRegistrationDistance = DoubleProperty::initialize("Max local registration distance (mm)", "", "Set max distance for local registration in mm", 30, DoubleRange(1, 200, 1), 0, root); mMaxLocalRegistrationDistance->setGuiRepresentation(DoubleProperty::grSLIDER); }
void BronchoscopyRegistrationWidget::createMaxNumberOfGenerations(QDomElement root) { mMaxNumberOfGenerations = DoubleProperty::initialize("Max number of generations in centerline", "", "Set max number of generations centerline", 4, DoubleRange(0, 10, 1), 0, root); mMaxNumberOfGenerations->setGuiRepresentation(DoublePropertyBase::grSLIDER); }
DoublePropertyPtr AirwaysFilter::getNoiseLevelOption(QDomElement root) { DoublePropertyPtr retval = DoubleProperty::initialize("Noise level", "", "Select the amount of noise present in the image", 0.5, DoubleRange(0.0, 2, 0.5), 1, root); retval->setGuiRepresentation(DoubleProperty::grSLIDER); return retval; }
DoublePropertyPtr DilationFilter::getDilationRadiusOption(QDomElement root) { DoublePropertyPtr retval = DoubleProperty::initialize("Dilation radius (mm)", "", "Set dilation radius in mm", 1, DoubleRange(1, 20, 1), 0, root); retval->setGuiRepresentation(DoublePropertyBase::grSLIDER); return retval; }
DoublePropertyPtr AirwaysFilter::getSensitivityOption(QDomElement root) { DoublePropertyPtr retval = DoubleProperty::initialize("Sensitivity", "", "Select sensitivity for the segmentation", 0.85, DoubleRange(0.01, 1, 0.01), 2, root); retval->setGuiRepresentation(DoubleProperty::grSLIDER); return retval; }
void EraserWidget::activeImageChangedSlot() { ImagePtr image = mPatientModelService->getActiveImage(); if(!image) return; mEraseValueAdapter->setValueRange(DoubleRange(image->getVTKMinValue(), image->getVTKMaxValue(), 1)); mEraseValueAdapter->setValue(image->getMin()); }
void FilterImpl::updateThresholdPairFromImageChange(QString uid, DoublePairPropertyPtr threshold) { ImagePtr image = mServices->patient()->getData<Image>(uid); if(!image) return; threshold->setValueRange(DoubleRange(image->getMin(), image->getMax(), 1)); int initLower = ::ceil(double(image->getMin()) + double(image->getRange())/10); // round up int initUpper = image->getMax(); threshold->setValue(Eigen::Vector2d(initLower, initUpper)); }
DoublePropertyBasePtr NetworkConnectionHandle::createPortOption() { DoublePropertyPtr retval; int defval = mClient->getConnectionInfo().port; retval = DoubleProperty::initialize("port", "Port", "Network Port (default "+QString::number(defval)+")", defval, DoubleRange(1024, 49151, 1), 0, mOptions.getElement()); retval->setGuiRepresentation(DoublePropertyBase::grSPINBOX); retval->setAdvanced(true); retval->setGroup("Connection"); connect(retval.get(), &Property::changed, this, &NetworkConnectionHandle::onPropertiesChanged); return retval; }
void FilterImpl::updateThresholdFromImageChange(QString uid, DoublePropertyPtr threshold) { ImagePtr image = mServices->patient()->getData<Image>(uid); if(!image) return; threshold->setValueRange(DoubleRange(image->getMin(), image->getMax(), 1)); int oldLower = threshold->getValue(); // avoid reset if old value is still within range, // but reset anyway if old val is 0..1, this can indicate old image was binary. if ((image->getMin() > oldLower )||( oldLower > image->getMax() )||( oldLower<=1 )) { int initLower = ::ceil(double(image->getMin()) + double(image->getRange())/10); // round up threshold->setValue(initLower); } // std::cout << "FilterImpl::imageChangedSlot " << image->getMin() << " " << image->getMax() << std::endl; // std::cout << " imageChangedSlot() " << threshold->getValue() << std::endl; }
void Transform3DWidget::addTranslationControls(QString uid, QString name, int index, QVBoxLayout* layout) { QHBoxLayout* hLayout = new QHBoxLayout; DoublePropertyPtr adapter = DoubleProperty::initialize(uid, name, "", 0, DoubleRange(-10000,10000,0.1),1); connect(adapter.get(), SIGNAL(changed()), this, SLOT(changedSlot())); adapter->setInternal2Display(1.0); hLayout->addWidget(new SpinBoxGroupWidget(this, adapter)); QSize mMinBarSize = QSize(20,20); MousePadWidget* pad = new MousePadWidget(this, mMinBarSize); pad->setFixedYPos(true); hLayout->addWidget(pad); // use QtSignalAdapters library to work magic: QtSignalAdapters::connect1<void(QPointF)>(pad, SIGNAL(mouseMoved(QPointF)), boost::bind(&Transform3DWidget::translateSlot, this, _1, index)); layout->addLayout(hLayout); mTranslationAdapter[index] = adapter; }
void VisualizationTab::init() { double sphereRadius = settings()->value("View3D/sphereRadius").toDouble(); mSphereRadius = DoubleProperty::initialize("SphereRadius", "Sphere Radius", "Radius of sphere markers in the 3D scene.", sphereRadius, DoubleRange(0.1,10,0.1), 1, QDomNode()); double labelSize = settings()->value("View3D/labelSize").toDouble(); mLabelSize = DoubleProperty::initialize("LabelSize", "Label Size", "Size of text labels in the 3D scene.", labelSize, DoubleRange(0.1,100,0.1), 1, QDomNode()); ColorSelectButton* backgroundColorButton = new ColorSelectButton("Background Color"); backgroundColorButton->setColor(settings()->value("backgroundColor").value<QColor>()); connect(backgroundColorButton, SIGNAL(colorChanged(QColor)), this, SLOT(setBackgroundColorSlot(QColor))); bool showDataText = settings()->value("View/showDataText").value<bool>(); mShowDataText = BoolProperty::initialize("Show Data Text", "", "Show the name of each data set in the views.", showDataText); bool showLabels = settings()->value("View/showLabels").value<bool>(); mShowLabels = BoolProperty::initialize("Show Labels", "", "Attach name labels to entities in the views.", showLabels); bool showMetricNamesInCorner = settings()->value("View/showMetricNamesInCorner").value<bool>(); mShowMetricNamesInCorner = BoolProperty::initialize("Corner Metrics", "", "Show the metric data in the upper right corner of the view instead of in the scene.", showMetricNamesInCorner); double annotationModelSize = settings()->value("View3D/annotationModelSize").toDouble(); mAnnotationModelSize = DoubleProperty::initialize("AnnotationModelSize", "Annotation Model Size", "Size (0..1) of the annotation model in the 3D scene.", annotationModelSize, DoubleRange(0.01,1,0.01), 2, QDomNode()); QStringList annotationModelRange; foreach(QString path, DataLocations::getRootConfigPaths()) { annotationModelRange << QDir(path+"/models/").entryList(QStringList()<<"*.stl"); }
void VisualizationTab::init() { double sphereRadius = settings()->value("View3D/sphereRadius").toDouble(); mSphereRadius = DoubleProperty::initialize("SphereRadius", "Sphere Radius", "Radius of sphere markers in the 3D scene.", sphereRadius, DoubleRange(0.1,10,0.1), 1, QDomNode()); double labelSize = settings()->value("View3D/labelSize").toDouble(); mLabelSize = DoubleProperty::initialize("LabelSize", "Label Size", "Size of text labels in the 3D scene.", labelSize, DoubleRange(0.1,100,0.1), 1, QDomNode()); SelectColorSettingButton* backgroundColorButton = new SelectColorSettingButton("Background Color", "backgroundColor", "Set 3D view background color"); SelectColorSettingButton* tool2DColor = new SelectColorSettingButton("Tool Color 2D", "View2D/toolColor", "Set the color of the tool in 2D"); SelectColorSettingButton* toolTipPointColor = new SelectColorSettingButton("Tool Tip 2D/3D", "View/toolTipPointColor", "Set the color of the tool tip in 2D/3D"); SelectColorSettingButton* toolOffsetPointColor = new SelectColorSettingButton("Offset Point 2D/3D", "View/toolOffsetPointColor", "Set the color of the tool offset point in 2D/3D"); SelectColorSettingButton* toolOffsetLineColor = new SelectColorSettingButton("Offset Line 2D/3D", "View/toolOffsetLineColor", "Set the color of the tool offset line in 2D/3D"); SelectColorSettingButton* toolCrossHairColor = new SelectColorSettingButton("Crosshair 2D", "View2D/toolCrossHairColor", "Set the color of the tool 2D crosshair"); bool showDataText = settings()->value("View/showDataText").value<bool>(); mShowDataText = BoolProperty::initialize("Show Data Text", "", "Show the name of each data set in the views.", showDataText); bool showLabels = settings()->value("View/showLabels").value<bool>(); mShowLabels = BoolProperty::initialize("Show Labels", "", "Attach name labels to entities in the views.", showLabels); bool toolCrosshair = settings()->value("View2D/showToolCrosshair").value<bool>(); mToolCrosshair = BoolProperty::initialize("Tool 2D Crosshair", "", "Show a crosshair centered on the tool in the orthogonal (ACS) views.", toolCrosshair); bool showMetricNamesInCorner = settings()->value("View/showMetricNamesInCorner").value<bool>(); mShowMetricNamesInCorner = BoolProperty::initialize("Corner Metrics", "", "Show the metric data in the upper right corner of the view instead of in the scene.", showMetricNamesInCorner); double annotationModelSize = settings()->value("View3D/annotationModelSize").toDouble(); mAnnotationModelSize = DoubleProperty::initialize("AnnotationModelSize", "Annotation Model Size", "Size (0..1) of the annotation model in the 3D scene.", annotationModelSize, DoubleRange(0.01,1,0.01), 2, QDomNode()); QStringList annotationModelRange; foreach(QString path, DataLocations::getRootConfigPaths()) { annotationModelRange << QDir(path+"/models/").entryList(QStringList()<<"*.stl"); }
EraserWidget::EraserWidget(PatientModelServicePtr patientModelService, VisualizationServicePtr visualizationService, QWidget* parent) : BaseWidget(parent, "EraserWidget", "Eraser"), mPreviousCenter(0,0,0), mPreviousRadius(0), mActiveImageProxy(ActiveImageProxyPtr()), mPatientModelService(patientModelService), mVisualizationService(visualizationService) { QVBoxLayout* layout = new QVBoxLayout(this); this->setToolTip("Erase parts of volumes/models"); mContinousEraseTimer = new QTimer(this); connect(mContinousEraseTimer, SIGNAL(timeout()), this, SLOT(continousRemoveSlot())); // this signal will be executed in the thread of THIS, i.e. the main thread. QHBoxLayout* buttonLayout = new QHBoxLayout; layout->addLayout(buttonLayout); QHBoxLayout* buttonLayout2 = new QHBoxLayout; layout->addLayout(buttonLayout2); mShowEraserCheckBox = new QCheckBox("Show"); mShowEraserCheckBox->setToolTip("Show eraser sphere in the views."); connect(mShowEraserCheckBox, SIGNAL(toggled(bool)), this, SLOT(toggleShowEraser(bool))); buttonLayout->addWidget(mShowEraserCheckBox); mContinousEraseCheckBox = new QCheckBox("Continous"); mContinousEraseCheckBox->setToolTip("Erase continously using the sphere. (might be slow)"); connect(mContinousEraseCheckBox, SIGNAL(toggled(bool)), this, SLOT(toggleContinous(bool))); buttonLayout2->addWidget(mContinousEraseCheckBox); mDuplicateAction = this->createAction(this, QIcon(), "Duplicate", "Duplicate active volume - do this before erasing!", SLOT(duplicateSlot()), buttonLayout); mSaveAction = this->createAction(this, QIcon(), "Save", "Save modified image to disk", SLOT(saveSlot()), buttonLayout); mRemoveAction = this->createAction(this, QIcon(), "Erase", "Erase everything inside sphere", SLOT(removeSlot()), buttonLayout2); double sphereRadius = 10; mSphereSizeAdapter = DoubleProperty::initialize("SphereSize", "Sphere Size", "Radius of Eraser Sphere", sphereRadius, DoubleRange(0,200,1), 0, QDomNode()); connect(mSphereSizeAdapter.get(), &DoubleProperty::changed, this, &EraserWidget::sphereSizeChangedSlot); mSphereSize = new SpinBoxAndSliderGroupWidget(this, mSphereSizeAdapter); layout->addWidget(mSphereSize); ImagePtr image = mPatientModelService->getActiveImage(); int eraseValue = 0; if(image) eraseValue = image->getMin(); mEraseValueAdapter = DoubleProperty::initialize("EraseValue", "Erase value", "Erase/draw with value", eraseValue, DoubleRange(1,200,1), 0, QDomNode()); mActiveImageProxy = ActiveImageProxy::New(mPatientModelService); connect(mActiveImageProxy.get(), &ActiveImageProxy::activeImageChanged, this, &EraserWidget::activeImageChangedSlot); mEraseValueWidget = new SpinBoxAndSliderGroupWidget(this, mEraseValueAdapter); layout->addWidget(mEraseValueWidget); layout->addStretch(); this->enableButtons(); }
DoublePropertyPtr SmoothingImageFilter::getSigma(QDomElement root) { return DoubleProperty::initialize("Smoothing sigma", "", "Used for smoothing the segmented volume. Measured in units of image spacing.", 0.10, DoubleRange(0, 5, 0.01), 2, root); }
void PerformanceTab::init() { int renderingInterval = settings()->value("renderingInterval").toInt(); QLabel* renderingIntervalLabel = new QLabel(tr("Rendering interval")); mRenderingIntervalSpinBox = new QSpinBox; mRenderingIntervalSpinBox->setSuffix("ms"); mRenderingIntervalSpinBox->setMinimum(4); mRenderingIntervalSpinBox->setMaximum(1000); mRenderingIntervalSpinBox->setValue(renderingInterval); connect(mRenderingIntervalSpinBox, SIGNAL(valueChanged(int)), this, SLOT(renderingIntervalSlot(int))); mRenderingRateLabel = new QLabel(""); this->renderingIntervalSlot(renderingInterval); double Mb = pow(10.0,6); bool ok = true; double maxRenderSize = settings()->value("View3D/maxRenderSize").toDouble(&ok); if (!ok) maxRenderSize = 10 * Mb; mMaxRenderSize = DoubleProperty::initialize("MaxRenderSize", "Max Render Size (Mb)", "Maximum size of volumes used in volume rendering. Applies to new volumes.", maxRenderSize, DoubleRange(1*Mb,300*Mb,1*Mb), 0, QDomNode()); mMaxRenderSize->setInternal2Display(1.0/Mb); double stillUpdateRate = settings()->value("stillUpdateRate").value<double>(); mStillUpdateRate = DoubleProperty::initialize("StillUpdateRate", "Still Update Rate", "<p>Still Update Rate in vtkRenderWindow. " "Increasing the value may improve rendering speed " "at the cost of render quality.</p> " "Generally raycast rendering requires this to be low (0.001), " "while texture based rendering requires it to be high (5-10)." "<p>Restart needed.</p>", stillUpdateRate, DoubleRange(0.0001, 20, 0.0001), 4, QDomNode()); mSmartRenderCheckBox = new QCheckBox("Smart Render"); mSmartRenderCheckBox->setChecked(settings()->value("smartRender", true).toBool()); mSmartRenderCheckBox->setToolTip("Render only when scene has changed, plus once per second."); m3DVisualizer = StringProperty::initialize("ImageRender3DVisualizer", "3D Renderer", "Select 3D visualization method for images", settings()->value("View3D/ImageRender3DVisualizer").toString(), this->getAvailableVisualizers(), QDomNode()); m3DVisualizer->setDisplayNames(this->getAvailableVisualizerDisplayNames()); bool useGPU2DRender = settings()->value("View2D/useGPU2DRendering").toBool(); mGPU2DRenderCheckBox = new QCheckBox("2D Overlay"); mGPU2DRenderCheckBox->setChecked(useGPU2DRender); mGPU2DRenderCheckBox->setToolTip("<p>Use a GPU-based 2D renderer instead of " "the software-based one, if available.</p>" "<p>This enables multiple volume rendering in 2D.<p>"); bool linearInterpolationIn2D = settings()->value("View2D/useLinearInterpolationIn2DRendering").toBool(); mLinearInterpolationIn2DCheckBox = new QCheckBox("Linear interpolation in 2D (Requires restart)"); mLinearInterpolationIn2DCheckBox->setChecked(linearInterpolationIn2D); mLinearInterpolationIn2DCheckBox->setToolTip("<p>Use linear interpolation in GPU 2D rendering " "instead of nearest.</p>" "<p>Requires restart.<p>"); bool optimizedViews = settings()->value("optimizedViews").toBool(); mOptimizedViewsCheckBox = new QCheckBox("Optimized Views"); mOptimizedViewsCheckBox->setChecked(optimizedViews); mOptimizedViewsCheckBox->setToolTip("<p>Merge all non-3D views into a single vtkRenderWindow</p>" "<p>This speeds up render on some platforms, still experimental.<p>"); bool useGPU3DDepthPeeling = settings()->value("View3D/depthPeeling").toBool(); mGPU3DDepthPeelingCheckBox = new QCheckBox("Use GPU 3D depth peeling"); mGPU3DDepthPeelingCheckBox->setChecked(useGPU3DDepthPeeling); mGPU3DDepthPeelingCheckBox->setToolTip("Use a GPU-based 3D depth peeling to correctly visualize translucent surfaces."); //Layout mMainLayout = new QGridLayout; mMainLayout->addWidget(renderingIntervalLabel, 0, 0); new SpinBoxGroupWidget(this, mMaxRenderSize, mMainLayout, 1); mMainLayout->addWidget(mRenderingIntervalSpinBox, 0, 1); mMainLayout->addWidget(mRenderingRateLabel, 0, 2); mMainLayout->addWidget(mSmartRenderCheckBox, 2, 0); mMainLayout->addWidget(mGPU2DRenderCheckBox, 5, 0); mMainLayout->addWidget(mLinearInterpolationIn2DCheckBox, 6, 0); mMainLayout->addWidget(mOptimizedViewsCheckBox, 7, 0); mMainLayout->addWidget(mGPU3DDepthPeelingCheckBox, 8, 0); new SpinBoxGroupWidget(this, mStillUpdateRate, mMainLayout, 9); mMainLayout->addWidget(sscCreateDataWidget(this, m3DVisualizer), 10, 0, 1, 2); mMainLayout->setColumnStretch(0, 2); mMainLayout->setColumnStretch(1, 2); mMainLayout->setColumnStretch(2, 1); mTopLayout->addLayout(mMainLayout); }
void MeshPropertyData::initialize() { //------------------------------------------------------------------------- mColor = ColorProperty::initialize("Color", "", "Mesh color", QColor("red")); this->addProperty(mColor); //------------------------------------------------------------------------- mUseColorFromPolydataScalars = BoolProperty::initialize( "colorFromPolydataScalars", "Color from polydata scalars", "If your polydata has a scalar array with color data in you can use that to color the mesh.", false); this->addProperty(mUseColorFromPolydataScalars); //------------------------------------------------------------------------- mVisSize = DoubleProperty::initialize("visSize", "Point size", "Visualized size of points, glyphs etc.", 2, DoubleRange(1, 20, 1), 0); mVisSize->setGuiRepresentation(DoublePropertyBase::grSLIDER); this->addProperty(mVisSize); //------------------------------------------------------------------------- mBackfaceCulling = BoolProperty::initialize("backfaceCulling", "Backface culling", "Set backface culling on. This makes transparent meshes work, " "but only draws outside mesh walls " "(eg. navigating inside meshes will not work).", false); this->addProperty(mBackfaceCulling); //------------------------------------------------------------------------- mFrontfaceCulling = BoolProperty::initialize("frontfaceCulling", "Frontface culling", "Set frontface culling on. Can be used to make transparent " "meshes work from inside the meshes.", false); this->addProperty(mFrontfaceCulling); //------------------------------------------------------------------------- mRepresentation = StringProperty::initialize("representation", "Representation", "How to represent model visually", QString::number(VTK_SURFACE), QStringList() << QString::number(VTK_SURFACE) << QString::number(VTK_WIREFRAME) << QString::number(VTK_POINTS)); std::map<QString,QString> representationNames; representationNames[QString::number(VTK_SURFACE)] = "Surface"; representationNames[QString::number(VTK_WIREFRAME)] = "Wireframe"; representationNames[QString::number(VTK_POINTS)] = "Points"; mRepresentation->setDisplayNames(representationNames); this->addProperty(mRepresentation); //------------------------------------------------------------------------- mEdgeVisibility = BoolProperty::initialize("edgeVisibility", "Show Edges", "Show model edges", false); this->addProperty(mEdgeVisibility); //------------------------------------------------------------------------- mEdgeColor = ColorProperty::initialize("edgeColor", "Edge color", "Edge color, used when edges are visible.", QColor("green")); this->addProperty(mEdgeColor); //------------------------------------------------------------------------- mAmbient = DoubleProperty::initialize("ambient", "Ambient", "Ambient color coefficient", 0.2, DoubleRange(0, 1, 0.05), 2); mAmbient->setGuiRepresentation(DoublePropertyBase::grSLIDER); this->addProperty(mAmbient); //------------------------------------------------------------------------- mDiffuse = DoubleProperty::initialize("diffuse", "Diffuse", "Diffuse color coefficient", 0.9, DoubleRange(0, 1, 0.05), 2); mDiffuse->setGuiRepresentation(DoublePropertyBase::grSLIDER); this->addProperty(mDiffuse); //------------------------------------------------------------------------- mSpecular = DoubleProperty::initialize("specular", "Specular", "Specular color coefficient", 0.3, DoubleRange(0, 1, 0.05), 2); mSpecular->setGuiRepresentation(DoublePropertyBase::grSLIDER); this->addProperty(mSpecular); //------------------------------------------------------------------------- mSpecularPower = DoubleProperty::initialize("specularPower", "Specular Power", "Specular color power", 15, DoubleRange(1, 30, 1), 0); mSpecularPower->setGuiRepresentation(DoublePropertyBase::grSLIDER); this->addProperty(mSpecularPower); //------------------------------------------------------------------------- }