diff --git a/qt/SettingsDialog.cxx b/qt/SettingsDialog.cxx index a393278..576564c 100644 --- a/qt/SettingsDialog.cxx +++ b/qt/SettingsDialog.cxx @@ -61,6 +61,9 @@ void SettingsDialog::initializeSettings() { // Neighbor radius neighborRadiusSpinBox->setValue(visualizationContainer->GetNeighborRadius()); + + // Dot size + dotSizeSpinBox->setValue(sliceView->GetDotSize()); } void SettingsDialog::on_windowSpinBox_valueChanged(double value) { @@ -132,6 +135,10 @@ void SettingsDialog::on_enableDotAnnotationCheckBox_stateChanged(int state) { emit enableDotAnnotationChanged(state != 0); } +void SettingsDialog::on_dotSizeSpinBox_valueChanged(double value) { + visualizationContainer->GetSliceView()->SetDotSize(value); +} + void SettingsDialog::on_flipAxisButton(int axis) { visualizationContainer->FlipAxis(axis); } \ No newline at end of file diff --git a/qt/SettingsDialog.h b/qt/SettingsDialog.h index 0f84f65..a73f39f 100644 --- a/qt/SettingsDialog.h +++ b/qt/SettingsDialog.h @@ -43,6 +43,7 @@ public slots: virtual void on_autoAdjustSamplingCheckBox_stateChanged(int state); virtual void on_enableDotAnnotationCheckBox_stateChanged(int state); + virtual void on_dotSizeSpinBox_valueChanged(double value); virtual void on_flipAxisButton(int axis); diff --git a/qt/SettingsDialog.ui b/qt/SettingsDialog.ui index f7ea299..00cca25 100644 --- a/qt/SettingsDialog.ui +++ b/qt/SettingsDialog.ui @@ -6,8 +6,8 @@ <rect> <x>0</x> <y>0</y> - <width>314</width> - <height>548</height> + <width>359</width> + <height>576</height> </rect> </property> <property name="windowTitle"> @@ -393,6 +393,33 @@ </item> </layout> </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_11"> + <item> + <widget class="QLabel" name="label_9"> + <property name="text"> + <string>2D dot size</string> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer_7"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QDoubleSpinBox" name="dotSizeSpinBox"/> + </item> + </layout> + </item> </layout> </widget> </item> @@ -426,6 +453,16 @@ </layout> </widget> </item> + <item> + <widget class="QDialogButtonBox" name="buttonBox"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="standardButtons"> + <set>QDialogButtonBox::Close</set> + </property> + </widget> + </item> <item> <spacer name="verticalSpacer"> <property name="orientation"> @@ -439,16 +476,6 @@ </property> </spacer> </item> - <item> - <widget class="QDialogButtonBox" name="buttonBox"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="standardButtons"> - <set>QDialogButtonBox::Close</set> - </property> - </widget> - </item> </layout> </widget> <resources/> diff --git a/region/Region.cxx b/region/Region.cxx index 60dd8a7..1a87ca4 100644 --- a/region/Region.cxx +++ b/region/Region.cxx @@ -638,7 +638,7 @@ void Region::SetComment(const std::string& commentString) { text->SetInput(LabelString().c_str()); } -void Region::ApplyDot() { +void Region::ApplyDot(double dotSize) { double* c = GetCenter(); int x = (int)c[0]; int y = (int)c[1]; @@ -652,12 +652,12 @@ void Region::ApplyDot() { data->Modified(); - int ext[6] = { x, x, y, y, z, z, }; + int ext[6] = { x, x, y, y, z, z }; SetExtent(ext); voi->Update(); center3D->Update(); - center2D->Update(center2D->GetActor()->GetPosition()[2]); + center2D->Update(center2D->GetActor()->GetPosition()[2], dotSize); } void Region::ClearLabels() { diff --git a/region/Region.h b/region/Region.h index 910014f..90fa67d 100644 --- a/region/Region.h +++ b/region/Region.h @@ -95,7 +95,7 @@ class Region { const std::string& GetComment(); void SetComment(const std::string& commentString); - void ApplyDot(); + void ApplyDot(double dotSize); protected: unsigned short label; diff --git a/region/RegionCenter2D.cxx b/region/RegionCenter2D.cxx index 9b09133..5555cca 100644 --- a/region/RegionCenter2D.cxx +++ b/region/RegionCenter2D.cxx @@ -36,7 +36,7 @@ RegionCenter2D::RegionCenter2D(Region* inputRegion, double color[3]) { actor->PickableOff(); actor->VisibilityOff(); - Update(region->GetCenter()[2]); + Update(region->GetCenter()[2], 1.25); } RegionCenter2D::~RegionCenter2D() { @@ -49,9 +49,7 @@ vtkSmartPointer<vtkActor> RegionCenter2D::GetActor() { return actor; } -void RegionCenter2D::Update(double z) { - double r = 1.25; - +void RegionCenter2D::Update(double z, double size) { double numSlices = 4.0; double* c = region->GetCenter(); @@ -62,7 +60,7 @@ void RegionCenter2D::Update(double z) { if (s < 0) s = 0; actor->SetPosition(c[0], c[1], z); - actor->SetScale(r * s); + actor->SetScale(size * s); double epsilon = 0.9; if (d < epsilon) { diff --git a/region/RegionCenter2D.h b/region/RegionCenter2D.h index b2f2fa4..7ae2a23 100644 --- a/region/RegionCenter2D.h +++ b/region/RegionCenter2D.h @@ -16,7 +16,7 @@ class RegionCenter2D { vtkSmartPointer<vtkActor> GetActor(); - void Update(double z); + void Update(double z, double size); protected: Region* region; diff --git a/visualization/SliceView.cxx b/visualization/SliceView.cxx index 1cb4bf8..c1c76d0 100644 --- a/visualization/SliceView.cxx +++ b/visualization/SliceView.cxx @@ -51,6 +51,7 @@ SliceView::SliceView(vtkRenderWindowInteractor* interactor, vtkLookupTable* lut) showRegionOutlines = true; rescaleMode = Full; autoRescale = true; + dotSize = 1.25; data = nullptr; labels = nullptr; @@ -202,7 +203,7 @@ void SliceView::AddRegionActors(Region* region) { regionOutlinesRenderer->AddActor(region->GetText()); regionOutlinesRenderer->AddActor(region->GetCenter2D()->GetActor()); - region->GetCenter2D()->Update(plane->GetOrigin()[2]); + region->GetCenter2D()->Update(plane->GetOrigin()[2], dotSize); #ifdef SHOW_REGION_BOX //regionOutlinesRenderer->AddActor(region->GetBox()); @@ -425,7 +426,7 @@ void SliceView::UpdatePlane() { if (regions) { for (RegionCollection::Iterator it = regions->Begin(); it != regions->End(); it++) { Region* region = regions->Get(it); - region->GetCenter2D()->Update(z); + region->GetCenter2D()->Update(z, dotSize); } } } @@ -435,6 +436,17 @@ void SliceView::SetBrushRadius(int radius) { brush->GetActor()->SetVisibility(radius > 1); } +double SliceView::GetDotSize() { + return dotSize; +} + +void SliceView::SetDotSize(double size) { + dotSize = size; + UpdatePlane(); + + Render(); +} + void SliceView::Render() { renderer->GetRenderWindow()->Render(); } diff --git a/visualization/SliceView.h b/visualization/SliceView.h index 5555b2f..f9c761c 100644 --- a/visualization/SliceView.h +++ b/visualization/SliceView.h @@ -73,6 +73,9 @@ class SliceView { void SetBrushRadius(int radius); + double GetDotSize(); + void SetDotSize(double size); + void SetOrientationX(); void SetOrientationY(); void SetOrientationZ(); @@ -85,6 +88,7 @@ class SliceView { protected: FilterMode filterMode; bool showRegionOutlines; + double dotSize; enum RescaleMode { Full, diff --git a/visualization/VisualizationContainer.cxx b/visualization/VisualizationContainer.cxx index e55c7f9..975e206 100644 --- a/visualization/VisualizationContainer.cxx +++ b/visualization/VisualizationContainer.cxx @@ -2037,7 +2037,7 @@ bool VisualizationContainer::CheckDots() { void VisualizationContainer::ApplyDotAnnotation() { for (RegionCollection::Iterator it = regions->Begin(); it != regions->End(); it++) { Region* region = regions->Get(it); - region->ApplyDot(); + region->ApplyDot(sliceView->GetDotSize()); } labels->Modified(); @@ -2515,7 +2515,7 @@ void VisualizationContainer::ExtractRegions(vtkIntArray* extents) { } if (interactionMode == DotMode) { - region->ApplyDot(); + region->ApplyDot(sliceView->GetDotSize()); region->ShowCenter(true); } @@ -2567,7 +2567,7 @@ void VisualizationContainer::ExtractRegions(const std::vector<RegionInfo>& metad } if (interactionMode == DotMode) { - region->ApplyDot(); + region->ApplyDot(sliceView->GetDotSize()); region->ShowCenter(true); } }