]> Creatis software - clitk.git/commitdiff
Allow unlinking of window/level of overlay, enable ctrl+w for local
authorSimon Rit <simon.rit@creatis.insa-lyon.fr>
Tue, 23 Aug 2011 17:05:58 +0000 (19:05 +0200)
committerSimon Rit <simon.rit@creatis.insa-lyon.fr>
Tue, 23 Aug 2011 17:14:27 +0000 (19:14 +0200)
windowing of fusion and overlay image

12 files changed:
vv/qt_ui/vvHelpDialog.ui
vv/qt_ui/vvOverlayPanel.ui
vv/vv.cxx
vv/vvMainWindow.cxx
vv/vvMainWindow.h
vv/vvOverlayPanel.cxx
vv/vvOverlayPanel.h
vv/vvSlicer.cxx
vv/vvSlicer.h
vv/vvSlicerManager.cxx
vv/vvSlicerManager.h
vv/vvSlicerManagerCommand.cxx

index 6c827c350650fdb74ed7e350fe541da027926051..29623b35426578c50b7bfa2165c34e9f785990f7 100644 (file)
@@ -22,9 +22,9 @@
         <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
 &lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
 p, li { white-space: pre-wrap; }
-&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans Serif'; font-size:10pt; font-weight:400; font-style:normal;&quot;&gt;
+&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
 &lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:12pt; font-weight:600;&quot;&gt;F1: &lt;/span&gt;&lt;span style=&quot; font-size:12pt;&quot;&gt;Help (this window)&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;/p&gt;
+&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:10pt;&quot;&gt;&lt;/p&gt;
 &lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:12pt; font-weight:600; text-decoration: underline;&quot;&gt;Slice Selection&lt;/span&gt;&lt;/p&gt;
 &lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:12pt; font-weight:600;&quot;&gt;&lt;/p&gt;
 &lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:12pt; font-weight:600;&quot;&gt;F2:&lt;/span&gt;&lt;span style=&quot; font-size:12pt;&quot;&gt; Sagital&lt;/span&gt;&lt;/p&gt;
@@ -38,6 +38,10 @@ p, li { white-space: pre-wrap; }
 &lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:12pt; font-weight:600;&quot;&gt;0,1,2,3,4,5&lt;/span&gt;&lt;span style=&quot; font-size:12pt;&quot;&gt; : Windowing Preset Selection&lt;/span&gt;&lt;/p&gt;
 &lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:12pt; font-weight:600;&quot;&gt;6,7,8,9&lt;/span&gt;&lt;span style=&quot; font-size:12pt;&quot;&gt;: Colormap Selection&lt;/span&gt;&lt;/p&gt;
 &lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:12pt; font-weight:600;&quot;&gt;w&lt;/span&gt;&lt;span style=&quot; font-size:12pt;&quot;&gt;: Local &lt;/span&gt;&lt;span style=&quot; font-size:12pt; text-decoration: underline;&quot;&gt;w&lt;/span&gt;&lt;span style=&quot; font-size:12pt;&quot;&gt;indowing around mouse cursor&lt;/span&gt;&lt;/p&gt;
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:12pt; font-weight:600;&quot;&gt;Ctrl+w&lt;/span&gt;&lt;span style=&quot; font-size:12pt;&quot;&gt;: Idem for fusion or overlay&lt;/span&gt;&lt;/p&gt;
+&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;/p&gt;
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:12pt; font-weight:600; text-decoration: underline;&quot;&gt;Miscellaneous&lt;/span&gt;&lt;/p&gt;
+&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:12pt;&quot;&gt;&lt;/p&gt;
 &lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:12pt; font-weight:600;&quot;&gt;l&lt;/span&gt;&lt;span style=&quot; font-size:12pt;&quot;&gt;: Toggle &lt;/span&gt;&lt;span style=&quot; font-size:12pt; text-decoration: underline;&quot;&gt;l&lt;/span&gt;&lt;span style=&quot; font-size:12pt;&quot;&gt;inear interpolation&lt;/span&gt;&lt;/p&gt;
 &lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:12pt; font-weight:600;&quot;&gt;c&lt;/span&gt;&lt;span style=&quot; font-size:12pt;&quot;&gt;: Toggle &lt;/span&gt;&lt;span style=&quot; font-size:12pt; text-decoration: underline;&quot;&gt;c&lt;/span&gt;&lt;span style=&quot; font-size:12pt;&quot;&gt;ontour superposition mode&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
        </property>
index af07fe8fd0f35a7a215193857ed36dad2ea0022f..eab2f23388823d0fc8e12a961cedc9d01dd2d8f8 100644 (file)
@@ -221,7 +221,7 @@ p, li { white-space: pre-wrap; }
      <property name="frameShadow">
       <enum>QFrame::Raised</enum>
      </property>
-     <layout class="QGridLayout">
+     <layout class="QGridLayout" name="compareGridLayout">
       <property name="margin">
        <number>2</number>
       </property>
@@ -267,7 +267,7 @@ p, li { white-space: pre-wrap; }
         </property>
        </widget>
       </item>
-      <item row="1" column="2">
+      <item row="1" column="1" colspan="5">
        <widget class="QSlider" name="colorHorizontalSlider">
         <property name="maximum">
          <number>359</number>
@@ -277,7 +277,7 @@ p, li { white-space: pre-wrap; }
         </property>
        </widget>
       </item>
-      <item row="2" column="0" colspan="3">
+      <item row="2" column="0" colspan="5">
        <widget class="QLabel" name="refValueLabel">
         <property name="sizePolicy">
          <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
@@ -290,7 +290,7 @@ p, li { white-space: pre-wrap; }
         </property>
        </widget>
       </item>
-      <item row="3" column="0" colspan="3">
+      <item row="3" column="0" colspan="5">
        <widget class="QLabel" name="valueLabel">
         <property name="sizePolicy">
          <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
@@ -303,7 +303,7 @@ p, li { white-space: pre-wrap; }
         </property>
        </widget>
       </item>
-      <item row="4" column="0" colspan="3">
+      <item row="4" column="0" colspan="5">
        <widget class="QLabel" name="diffValueLabel">
         <property name="sizePolicy">
          <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
@@ -316,6 +316,81 @@ p, li { white-space: pre-wrap; }
         </property>
        </widget>
       </item>
+      <item row="5" column="0">
+       <widget class="QLabel" name="label_10">
+        <property name="text">
+         <string>Window :</string>
+        </property>
+       </widget>
+      </item>
+      <item row="5" column="1">
+       <widget class="QDoubleSpinBox" name="overlayWindowSpinBox">
+        <property name="decimals">
+         <number>4</number>
+        </property>
+        <property name="minimum">
+         <double>-999999.000000000000000</double>
+        </property>
+        <property name="maximum">
+         <double>999999.000000000000000</double>
+        </property>
+        <property name="singleStep">
+         <double>10.000000000000000</double>
+        </property>
+        <property name="value">
+         <double>100.000000000000000</double>
+        </property>
+       </widget>
+      </item>
+      <item row="5" column="2">
+       <widget class="QLabel" name="label_11">
+        <property name="text">
+         <string>Level :</string>
+        </property>
+       </widget>
+      </item>
+      <item row="5" column="3">
+       <widget class="QDoubleSpinBox" name="overlayLevelSpinBox">
+        <property name="decimals">
+         <number>4</number>
+        </property>
+        <property name="minimum">
+         <double>-999999.000000000000000</double>
+        </property>
+        <property name="maximum">
+         <double>999999.000000000000000</double>
+        </property>
+        <property name="singleStep">
+         <double>10.000000000000000</double>
+        </property>
+        <property name="value">
+         <double>1000.000000000000000</double>
+        </property>
+       </widget>
+      </item>
+      <item row="5" column="4">
+       <spacer name="horizontalSpacer">
+        <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 row="5" column="5">
+       <widget class="QCheckBox" name="overlayLinkCheckBox">
+        <property name="text">
+         <string>Link</string>
+        </property>
+        <property name="checked">
+         <bool>true</bool>
+        </property>
+       </widget>
+      </item>
      </layout>
     </widget>
    </item>
@@ -330,7 +405,7 @@ p, li { white-space: pre-wrap; }
      <property name="frameShadow">
       <enum>QFrame::Raised</enum>
      </property>
-     <layout class="QGridLayout" name="gridLayout">
+     <layout class="QGridLayout" name="fusionGridLayout">
       <item row="0" column="0">
        <widget class="QLabel" name="label_5">
         <property name="maximumSize">
@@ -462,7 +537,7 @@ p, li { white-space: pre-wrap; }
        </widget>
       </item>
       <item row="4" column="2" colspan="2">
-       <widget class="QDoubleSpinBox" name="windowSpinBox">
+       <widget class="QDoubleSpinBox" name="fusionWindowSpinBox">
         <property name="decimals">
          <number>4</number>
         </property>
@@ -488,7 +563,7 @@ p, li { white-space: pre-wrap; }
        </widget>
       </item>
       <item row="4" column="5">
-       <widget class="QDoubleSpinBox" name="levelSpinBox">
+       <widget class="QDoubleSpinBox" name="fusionLevelSpinBox">
         <property name="decimals">
          <number>4</number>
         </property>
@@ -538,7 +613,6 @@ p, li { white-space: pre-wrap; }
   </layout>
  </widget>
  <resources>
-  <include location="../vvIcons.qrc"/>
   <include location="../vvIcons.qrc"/>
   <include location="vvIcons.qrc"/>
  </resources>
index 546f68afae8338147581ebbaac9e397a4f1096a7..981105095d68a80934280b6e332895cc1d42fa9a 100644 (file)
--- a/vv/vv.cxx
+++ b/vv/vv.cxx
@@ -192,7 +192,7 @@ int main( int argc, char** argv )
   }
 
   if(win!="" && lev!="") {
-    window.WindowLevelChanged(atof(win.c_str()), atof(lev.c_str()), 6, 0);
+    window.SetWindowLevel(atof(win.c_str()), atof(lev.c_str()));
     window.ApplyWindowLevelToAllImages();
   }
 
index 3d8c51a5a78f2ed85a0e61bc293a9599b7f584c4..1c2230f57160a8aa43e904f4e40734ed6233211a 100644 (file)
@@ -294,7 +294,8 @@ vvMainWindow::vvMainWindow():vvMainWindowBase()
   connect(linkPanel,SIGNAL(addLink(QString,QString)),this,SLOT(AddLink(QString,QString)));
   connect(linkPanel,SIGNAL(removeLink(QString,QString)),this,SLOT(RemoveLink(QString,QString)));
   connect(overlayPanel,SIGNAL(VFPropertyUpdated(int,int,int,int,double,double,double)),this,SLOT(SetVFProperty(int,int,int,int,double,double,double)));
-  connect(overlayPanel,SIGNAL(OverlayPropertyUpdated(int)),this,SLOT(SetOverlayProperty(int)));
+  connect(overlayPanel,SIGNAL(OverlayPropertyUpdated(int,int,double,double)),
+          this,SLOT(SetOverlayProperty(int,int,double,double)));
   connect(overlayPanel,SIGNAL(FusionPropertyUpdated(int,int,int,double,double)),
           this,SLOT(SetFusionProperty(int,int,int,double,double)));
   connect(landmarksPanel,SIGNAL(UpdateRenderWindows()),this,SLOT(UpdateRenderWindows()));
@@ -915,8 +916,8 @@ void vvMainWindow::LoadImages(std::vector<std::string> files, vvImageReader::Loa
                 this, SLOT(OverlayChanged(int,double,double)));
         connect(mSlicerManagers.back(), SIGNAL(UpdateFusion(int, double)),
                 this, SLOT(FusionChanged(int,double)));
-        connect(mSlicerManagers.back(), SIGNAL(WindowLevelChanged(double, double,int, int)),
-                this,SLOT(WindowLevelChanged(double, double, int, int)));
+        connect(mSlicerManagers.back(), SIGNAL(WindowLevelChanged()),
+                this,SLOT(WindowLevelChanged()));
         connect(mSlicerManagers.back(), SIGNAL(UpdateSlice(int,int)),
                 this,SLOT(UpdateSlice(int,int)));
         connect(mSlicerManagers.back(), SIGNAL(UpdateTSlice(int, int)),
@@ -1122,10 +1123,6 @@ void vvMainWindow::ImageInfoChanged()
         break;
       }
     }
-    windowSpinBox->setValue(mSlicerManagers[index]->GetColorWindow());
-    levelSpinBox->setValue(mSlicerManagers[index]->GetColorLevel());
-    presetComboBox->setCurrentIndex(mSlicerManagers[index]->GetPreset());
-    colorMapComboBox->setCurrentIndex(mSlicerManagers[index]->GetColorMap());
 
     infoPanel->setFileName(image);
     infoPanel->setDimension(dim);
@@ -1147,10 +1144,7 @@ void vvMainWindow::ImageInfoChanged()
         break;
       }
     }
-    windowSpinBox->setValue(mSlicerManagers[index]->GetColorWindow());
-    levelSpinBox->setValue(mSlicerManagers[index]->GetColorLevel());
-    presetComboBox->setCurrentIndex(mSlicerManagers[index]->GetPreset());
-    colorMapComboBox->setCurrentIndex(mSlicerManagers[index]->GetColorMap());
+    WindowLevelChanged();
 
     if (mSlicerManagers[index]->GetSlicer(0)->GetVF()) {
       overlayPanel->getVFName(mSlicerManagers[index]->GetVFName().c_str());
@@ -1163,22 +1157,14 @@ void vvMainWindow::ImageInfoChanged()
     }
     if (mSlicerManagers[index]->GetSlicer(0)->GetOverlay()) {
       overlayPanel->getOverlayName(mSlicerManagers[index]->GetOverlayName().c_str());
-      overlayPanel->getOverlayProperty(mSlicerManagers[index]->GetOverlayColor());
     } else {
       overlayPanel->getOverlayName(mSlicerManagers[index]->GetOverlayName().c_str());
-      overlayPanel->getOverlayProperty(-1);
     }
     
     if (mSlicerManagers[index]->GetSlicer(0)->GetFusion()) {
       overlayPanel->getFusionName(mSlicerManagers[index]->GetFusionName().c_str());
-      overlayPanel->getFusionProperty(mSlicerManagers[index]->GetFusionOpacity(),
-                                      mSlicerManagers[index]->GetFusionThresholdOpacity(),
-                                      mSlicerManagers[index]->GetFusionColorMap(),
-                                      mSlicerManagers[index]->GetFusionWindow(),
-                                      mSlicerManagers[index]->GetFusionLevel());
     } else {
       overlayPanel->getFusionName(mSlicerManagers[index]->GetFusionName().c_str());
-      overlayPanel->getFusionProperty(-1, -1, -1, -1, -1);
     }
   }
 }
@@ -1629,12 +1615,34 @@ void vvMainWindow::FusionChanged(int visibility, double value)
 //------------------------------------------------------------------------------
 
 //------------------------------------------------------------------------------
-void vvMainWindow::WindowLevelChanged(double window, double level,int preset,int colormap)
+void vvMainWindow::WindowLevelChanged()
 {
-  windowSpinBox->setValue(window);
-  levelSpinBox->setValue(level);
-  colorMapComboBox->setCurrentIndex(colormap);
-  presetComboBox->setCurrentIndex(preset);
+  // Base image
+  int index = GetSlicerIndexFromItem(DataTree->selectedItems()[0]);
+  if(index==-1) return;
+  windowSpinBox->setValue(mSlicerManagers[index]->GetColorWindow());
+  levelSpinBox->setValue(mSlicerManagers[index]->GetColorLevel());
+  colorMapComboBox->setCurrentIndex(mSlicerManagers[index]->GetColorMap());
+  presetComboBox->setCurrentIndex(mSlicerManagers[index]->GetPreset());
+
+  // Overlay image
+  if (mSlicerManagers[index]->GetSlicer(0)->GetOverlay())
+    overlayPanel->getOverlayProperty(mSlicerManagers[index]->GetOverlayColor(),
+                                     mSlicerManagers[index]->GetLinkOverlayWindowLevel(),
+                                     mSlicerManagers[index]->GetOverlayColorWindow(),
+                                     mSlicerManagers[index]->GetOverlayColorLevel());
+  else
+    overlayPanel->getOverlayProperty(-1,0,0.,0.);
+
+  // Fusion image
+  if (mSlicerManagers[index]->GetSlicer(0)->GetFusion())
+    overlayPanel->getFusionProperty(mSlicerManagers[index]->GetFusionOpacity(),
+                                    mSlicerManagers[index]->GetFusionThresholdOpacity(),
+                                    mSlicerManagers[index]->GetFusionColorMap(),
+                                    mSlicerManagers[index]->GetFusionWindow(),
+                                    mSlicerManagers[index]->GetFusionLevel());
+  else
+    overlayPanel->getFusionProperty(-1, -1, -1, -1, -1);
 }
 //------------------------------------------------------------------------------
 
@@ -1646,6 +1654,17 @@ void vvMainWindow::WindowLevelEdited()
 }
 //------------------------------------------------------------------------------
 
+//------------------------------------------------------------------------------
+void vvMainWindow::SetWindowLevel(double w, double l)
+{
+  windowSpinBox->setValue(w);
+  levelSpinBox->setValue(l);
+  presetComboBox->setCurrentIndex(6);
+  colorMapComboBox->setCurrentIndex(0);
+  UpdateWindowLevel();
+}
+//------------------------------------------------------------------------------
+
 //------------------------------------------------------------------------------
 void vvMainWindow::UpdateWindowLevel()
 {
@@ -1657,8 +1676,7 @@ void vvMainWindow::UpdateWindowLevel()
     mSlicerManagers[index]->SetColorLevel(levelSpinBox->value());
     mSlicerManagers[index]->SetPreset(presetComboBox->currentIndex());
     mSlicerManagers[index]->Render();
-    windowSpinBox->setValue(mSlicerManagers[index]->GetColorWindow());
-    levelSpinBox->setValue(mSlicerManagers[index]->GetColorLevel());
+    WindowLevelChanged();
   }
 }
 //------------------------------------------------------------------------------
@@ -1854,6 +1872,7 @@ void vvMainWindow::AddOverlayImage(int index, QString file)
     error += mSlicerManagers[index]->GetLastError().c_str();
     QMessageBox::information(this,tr("Problem reading image !"),error);
   }
+  WindowLevelChanged();
 }
 //------------------------------------------------------------------------------
 
@@ -2137,12 +2156,15 @@ void vvMainWindow::SetVFProperty(int subsampling, int scale, int log, int width,
 
 
 //------------------------------------------------------------------------------
-void vvMainWindow::SetOverlayProperty(int color)
+void vvMainWindow::SetOverlayProperty(int color, int linked, double window, double level)
 {
   int index = GetSlicerIndexFromItem(DataTree->selectedItems()[0]);
   if (mSlicerManagers[index]->GetSlicer(0)->GetOverlay()) {
     mSlicerManagers[index]->SetOverlayColor(color);
     mSlicerManagers[index]->SetColorMap(0);
+    mSlicerManagers[index]->SetLinkOverlayWindowLevel(linked);
+    mSlicerManagers[index]->SetOverlayColorWindow(window);
+    mSlicerManagers[index]->SetOverlayColorLevel(level);
     mSlicerManagers[index]->Render();
   }
 }
@@ -2836,8 +2858,8 @@ vvSlicerManager* vvMainWindow::AddImage(vvImage::Pointer image,std::string filen
           this, SLOT(OverlayChanged(int,double,double)));
   connect(mSlicerManagers.back(), SIGNAL(UpdateFusion(int, double)),
           this, SLOT(FusionChanged(int,double)));
-  connect(mSlicerManagers.back(), SIGNAL(WindowLevelChanged(double, double,int, int)),
-          this,SLOT(WindowLevelChanged(double, double, int, int)));
+  connect(mSlicerManagers.back(), SIGNAL(WindowLevelChanged()),
+          this,SLOT(WindowLevelChanged()));
   connect(mSlicerManagers.back(), SIGNAL(UpdateSlice(int,int)),
           this,SLOT(UpdateSlice(int,int)));
   connect(mSlicerManagers.back(), SIGNAL(UpdateTSlice(int, int)),
index 7da8a9171ecc8e0018cdf5606daef1f947eb75ed..8ee5ab26178adf4d421514e1c9a8a147c79765b9 100644 (file)
@@ -101,11 +101,12 @@ public slots:
   void SegmentationOnCurrentImage();
   void SurfaceViewerLaunch();
 
-  void WindowLevelChanged(double window, double level,int preset, int colormap);
+  void WindowLevelChanged();
   void UpdateSlice(int slicer, int slice);
   void UpdateTSlice(int slicer, int slice);
   void UpdateSliceRange(int slicer, int min, int max, int tmin, int tmax);
   void WindowLevelEdited();
+  void SetWindowLevel(double w, double l);
   void UpdateColorMap();
   void UpdateWindowLevel();
   void SwitchWindowLevel();
@@ -142,7 +143,7 @@ public slots:
   void ResetTransformationToIdentity();
 
   void SetVFProperty(int subsampling,int scale,int lut, int width, double r, double g, double b);
-  void SetOverlayProperty(int color);
+  void SetOverlayProperty(int color, int linked, double window, double level);
   void SetFusionProperty(int opacity, int tresOpacity, int colormap,double window,double level);
 
   void GoToCursor();
index bc3a7d0180ffa93dcc024c5e14766fe5f3a7daa2..eb2eaa1c7b2d27950d27551ea8943884fb366f8d 100644 (file)
@@ -47,9 +47,12 @@ vvOverlayPanel::vvOverlayPanel(QWidget * parent):QWidget(parent)
   connect(opacityHorizontalSlider,SIGNAL(valueChanged(int)),this,SLOT(setFusionProperty()));
   connect(thresOpacityHorizontalSlider,SIGNAL(valueChanged(int)),this,SLOT(setFusionProperty()));
   connect(fusionColorMapComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(setFusionProperty()));
-  connect(windowSpinBox,SIGNAL(valueChanged(double)),this,SLOT(setFusionProperty()));
-  connect(levelSpinBox,SIGNAL(valueChanged(double)),this,SLOT(setFusionProperty()));
-  
+  connect(fusionWindowSpinBox,SIGNAL(valueChanged(double)),this,SLOT(setFusionProperty()));
+  connect(fusionLevelSpinBox,SIGNAL(valueChanged(double)),this,SLOT(setFusionProperty()));
+  connect(overlayWindowSpinBox,SIGNAL(valueChanged(double)),this,SLOT(setOverlayProperty()));
+  connect(overlayLevelSpinBox,SIGNAL(valueChanged(double)),this,SLOT(setOverlayProperty()));
+  connect(overlayLinkCheckBox,SIGNAL(stateChanged(int)),this,SLOT(setOverlayProperty()));
+
   disableFusionSignals = false;
 }
 
@@ -125,13 +128,16 @@ void vvOverlayPanel::getOverlayName(QString name)
   imageComparedLabel->setText(filename.toStdString().c_str());
 }
 
-void vvOverlayPanel::getOverlayProperty(int value)
+void vvOverlayPanel::getOverlayProperty(int color, int linked, double window, double level)
 {
-  if (value > -1) {
+  if (color > -1) {
     compareFrame->show();
     compareFrame->setEnabled(1);
     colorHorizontalSlider->setEnabled(1);
-    colorHorizontalSlider->setValue(value);
+    colorHorizontalSlider->setValue(color);
+    overlayLinkCheckBox->setCheckState( (linked)?Qt::Checked:Qt::Unchecked );
+    overlayWindowSpinBox->setValue(window);
+    overlayLevelSpinBox->setValue(level);
   } else {
     compareFrame->hide();
     compareFrame->setEnabled(0);
@@ -142,7 +148,12 @@ void vvOverlayPanel::getOverlayProperty(int value)
 
 void vvOverlayPanel::setOverlayProperty()
 {
-  emit OverlayPropertyUpdated(colorHorizontalSlider->value());
+  overlayWindowSpinBox->setEnabled(!overlayLinkCheckBox->checkState());
+  overlayLevelSpinBox->setEnabled(!overlayLinkCheckBox->checkState());
+  emit OverlayPropertyUpdated(colorHorizontalSlider->value(),
+                              overlayLinkCheckBox->checkState(),
+                              overlayWindowSpinBox->value(),
+                              overlayLevelSpinBox->value());
 }
 
 void vvOverlayPanel::getCurrentOverlayInfo(int visibility,double valueOver, double valueRef)
@@ -179,10 +190,10 @@ void vvOverlayPanel::getFusionProperty(int opacity, int thresOpacity, int colorm
     opacityHorizontalSlider->setValue(opacity);
     thresOpacityHorizontalSlider->setEnabled(1);
     thresOpacityHorizontalSlider->setValue(thresOpacity);
-    windowSpinBox->setEnabled(1);
-    levelSpinBox->setEnabled(1);
-    windowSpinBox->setValue(window);
-    levelSpinBox->setValue(level);
+    fusionWindowSpinBox->setEnabled(1);
+    fusionLevelSpinBox->setEnabled(1);
+    fusionWindowSpinBox->setValue(window);
+    fusionLevelSpinBox->setValue(level);
     
     // re-enable signals and trigger slot function
     disableFusionSignals = false;
@@ -196,8 +207,8 @@ void vvOverlayPanel::getFusionProperty(int opacity, int thresOpacity, int colorm
     thresOpacityHorizontalSlider->setValue(0);
     fusionColorMapComboBox->setEnabled(0);
     fusionColorMapComboBox->setCurrentIndex(-1);
-    windowSpinBox->setEnabled(0);
-    levelSpinBox->setEnabled(0);
+    fusionWindowSpinBox->setEnabled(0);
+    fusionLevelSpinBox->setEnabled(0);
   }
 }
 
@@ -207,7 +218,7 @@ void vvOverlayPanel::setFusionProperty()
     return;
   
   emit FusionPropertyUpdated(opacityHorizontalSlider->value(), thresOpacityHorizontalSlider->value(), fusionColorMapComboBox->currentIndex(),
-                             windowSpinBox->value(), levelSpinBox->value());
+                             fusionWindowSpinBox->value(), fusionLevelSpinBox->value());
 }
 
 void vvOverlayPanel::getCurrentFusionInfo(int visibility,double value)
index 5000e6444b83ef3248c33b732a3044475b842022..63bad7bc633c3461ad19d39e1b3b5f51ab2342b5 100644 (file)
@@ -38,7 +38,7 @@ public:
     void getVFProperty(int subsampling, int scale, int log);
     void getVFName(QString name);
 
-    void getOverlayProperty(int color);
+    void getOverlayProperty(int color, int linked, double window, double level);
     void getOverlayName(QString name);
 
     void getFusionProperty(int opacity, int thresOpacity, int colormap, double window, double level);
@@ -56,7 +56,7 @@ public slots:
 
 signals:
     void VFPropertyUpdated(int subsampling, int scale, int log, int width, double r, double g, double b);
-    void OverlayPropertyUpdated(int color);
+    void OverlayPropertyUpdated(int color, int linked, double window, double level);
     void FusionPropertyUpdated(int opacity, int thresOpacity, int colormap, double window, double level);
 
     
index 302da7eae2689d6d7ef7d2657a6fa42e80babc4f..2473c87e27c3ca8dd84b33c047d199bea685f7b3 100644 (file)
@@ -135,6 +135,8 @@ vvSlicer::vvSlicer()
   this->WindowLevel = vvImageMapToWLColors::New();
 
   this->InstallPipeline();
+
+  mLinkOverlayWindowLevel = true;
 }
 //------------------------------------------------------------------------------
 
@@ -1111,7 +1113,6 @@ void vvSlicer::SetColorWindow(double window)
 }
 //----------------------------------------------------------------------------
 
-
 //----------------------------------------------------------------------------
 void vvSlicer::SetColorLevel(double level)
 {
@@ -1125,9 +1126,43 @@ void vvSlicer::SetColorLevel(double level)
 }
 //----------------------------------------------------------------------------
 
+//----------------------------------------------------------------------------
+double vvSlicer::GetOverlayColorWindow()
+{
+  if(mOverlayMapper)
+    return mOverlayMapper->GetWindow();
+  else
+    return 0.;
+}
+//----------------------------------------------------------------------------
+
+//----------------------------------------------------------------------------
+double vvSlicer::GetOverlayColorLevel()
+{
+  if(mOverlayMapper)
+    return mOverlayMapper->GetLevel();
+  else
+    return 0.;
+}
+//----------------------------------------------------------------------------
+
+//----------------------------------------------------------------------------
+void vvSlicer::SetOverlayColorWindow(double window)
+{
+  mOverlayMapper->SetWindow(window);
+}
+//----------------------------------------------------------------------------
+
+//----------------------------------------------------------------------------
+void vvSlicer::SetOverlayColorLevel(double level)
+{
+  mOverlayMapper->SetLevel(level);
+}
+//----------------------------------------------------------------------------
+
 //----------------------------------------------------------------------------
 // Returns the min an the max value in a 41x41 region around the mouse pointer
-void vvSlicer::GetExtremasAroundMousePointer(double & min, double & max)
+void vvSlicer::GetExtremasAroundMousePointer(double & min, double & max, vtkImageData *image)
 {
   //Get mouse pointer position in view coordinates
   double fLocalExtents[6];
@@ -1149,8 +1184,8 @@ void vvSlicer::GetExtremasAroundMousePointer(double & min, double & max)
   //Convert to image pixel coordinates (rounded)
   int iLocalExtents[6];
   for(int i=0; i<3; i++) {
-    fLocalExtents[i*2  ] = (fLocalExtents[i*2  ] - this->GetInput()->GetOrigin()[i])/this->GetInput()->GetSpacing()[i];
-    fLocalExtents[i*2+1] = (fLocalExtents[i*2+1] - this->GetInput()->GetOrigin()[i])/this->GetInput()->GetSpacing()[i];
+    fLocalExtents[i*2  ] = (fLocalExtents[i*2  ] - image->GetOrigin()[i])/image->GetSpacing()[i];
+    fLocalExtents[i*2+1] = (fLocalExtents[i*2+1] - image->GetOrigin()[i])/image->GetSpacing()[i];
 
     iLocalExtents[i*2  ] = lrint(fLocalExtents[i*2  ]);
     iLocalExtents[i*2+1] = lrint(fLocalExtents[i*2+1]);
@@ -1160,7 +1195,7 @@ void vvSlicer::GetExtremasAroundMousePointer(double & min, double & max)
   }
 
   vtkSmartPointer<vtkExtractVOI> voiFilter = vtkSmartPointer<vtkExtractVOI>::New();
-  voiFilter->SetInput(this->GetInput());
+  voiFilter->SetInput(image);
   voiFilter->SetVOI(iLocalExtents);
   voiFilter->Update();
   if (!voiFilter->GetOutput()->GetNumberOfPoints()) {
@@ -1275,8 +1310,10 @@ void vvSlicer::Render()
 
 
   if (mOverlay && mOverlayActor->GetVisibility()) {
-    mOverlayMapper->SetWindow(this->GetColorWindow());
-    mOverlayMapper->SetLevel(this->GetColorLevel());
+    if(mLinkOverlayWindowLevel) {
+      mOverlayMapper->SetWindow(this->GetColorWindow());
+      mOverlayMapper->SetLevel(this->GetColorLevel());
+    }
     mOverlayMapper->GetOutput()->SetUpdateExtent(mOverlayActor->GetDisplayExtent());
     mOverlayMapper->GetOutput()->Update();
     mOverlayMapper->Update();
index 0536bc1e7ef38995f20918af8d53d9b0c73b93be..a5156f28bc92e4f3c08e49db2c30b74c46d44ff9 100644 (file)
@@ -153,7 +153,7 @@ public:
   void SetCornerAnnotationVisibility(bool s);
   bool GetCornerAnnotationVisibility();
 
-  void GetExtremasAroundMousePointer(double & min, double & max);
+  void GetExtremasAroundMousePointer(double & min, double & max, vtkImageData *image);
 
   void UpdateLandmarks();
   void ForceUpdateDisplayExtent();
@@ -168,6 +168,14 @@ public:
   virtual void SetColorWindow(double s);
   virtual void SetColorLevel(double s);
 
+  double GetOverlayColorWindow();
+  double GetOverlayColorLevel();
+  bool GetLinkOverlayWindowLevel() { return mLinkOverlayWindowLevel; }
+
+  void SetOverlayColorWindow(double s);
+  void SetOverlayColorLevel(double s);
+  void SetLinkOverlayWindowLevel(bool b) { mLinkOverlayWindowLevel = b; }
+
   /**
    * When it is enabled, beware of a call to GetExtent.
    * we must have setted mReducedExtent otherwhise random values
@@ -235,6 +243,7 @@ protected:
   bool mUseReducedExtent;
   int * mReducedExtent;
   int * mInitialExtent;
+  bool mLinkOverlayWindowLevel;
 
 private:
   void UpdateOrientation();
index fd8f09fccc30b4667a6e271076ca5000f2839512..c38496e5ab50b2389311eb4788f8f8ee428a0178 100644 (file)
@@ -512,7 +512,6 @@ void vvSlicerManager::SetColorWindow(double s)
 }
 //----------------------------------------------------------------------------
 
-
 //----------------------------------------------------------------------------
 void vvSlicerManager::SetColorLevel(double s)
 {
@@ -522,6 +521,33 @@ void vvSlicerManager::SetColorLevel(double s)
 }
 //----------------------------------------------------------------------------
 
+//----------------------------------------------------------------------------
+void vvSlicerManager::SetOverlayColorWindow(double s)
+{
+  for ( unsigned int i = 0; i < mSlicers.size(); i++) {
+    mSlicers[i]->SetOverlayColorWindow(s);
+  }
+}
+//----------------------------------------------------------------------------
+
+//----------------------------------------------------------------------------
+void vvSlicerManager::SetOverlayColorLevel(double s)
+{
+  for ( unsigned int i = 0; i < mSlicers.size(); i++) {
+    mSlicers[i]->SetOverlayColorLevel(s);
+  }
+}
+//----------------------------------------------------------------------------
+
+//----------------------------------------------------------------------------
+void vvSlicerManager::SetLinkOverlayWindowLevel(bool b)
+{
+  for ( unsigned int i = 0; i < mSlicers.size(); i++) {
+    mSlicers[i]->SetLinkOverlayWindowLevel(b);
+  }
+}
+//----------------------------------------------------------------------------
+
 //----------------------------------------------------------------------------
 void vvSlicerManager::SetCursorAndCornerAnnotationVisibility(int s)
 {
@@ -736,6 +762,33 @@ double vvSlicerManager::GetColorLevel()
 }
 //----------------------------------------------------------------------------
 
+//----------------------------------------------------------------------------
+double vvSlicerManager::GetOverlayColorWindow()
+{
+  if (mSlicers.size())
+    return mSlicers[0]->GetOverlayColorWindow();
+  return -1;
+}
+//----------------------------------------------------------------------------
+
+//----------------------------------------------------------------------------
+double vvSlicerManager::GetOverlayColorLevel()
+{
+  if (mSlicers.size())
+    return mSlicers[0]->GetOverlayColorLevel();
+  return -1;
+}
+//----------------------------------------------------------------------------
+
+//----------------------------------------------------------------------------
+bool vvSlicerManager::GetLinkOverlayWindowLevel()
+{
+  if (mSlicers.size())
+    return mSlicers[0]->GetLinkOverlayWindowLevel();
+  return -1;
+}
+//----------------------------------------------------------------------------
+
 //------------------------------------------------------------------------------
 void vvSlicerManager::ResetTransformationToIdentity(const std::string actorType)
 {
@@ -950,10 +1003,11 @@ void vvSlicerManager::Picked()
 }
 //----------------------------------------------------------------------------
 
+
 //----------------------------------------------------------------------------
 void vvSlicerManager::UpdateWindowLevel()
 {
-  emit WindowLevelChanged(mSlicers[0]->GetColorWindow(),mSlicers[0]->GetColorLevel(),mPreset,mColorMap);
+  emit WindowLevelChanged();
 }
 //----------------------------------------------------------------------------
 
@@ -1057,14 +1111,34 @@ void vvSlicerManager::SetPreset(int preset)
 
 
 //----------------------------------------------------------------------------
-void vvSlicerManager::SetLocalColorWindowing(const int slicer)
+void vvSlicerManager::SetLocalColorWindowing(const int slicer, const bool bCtrlKey)
 {
   double min, max;
-  this->mSlicers[slicer]->GetExtremasAroundMousePointer(min, max);
-  this->SetColorWindow(max-min);
-  this->SetColorLevel(0.5*(min+max));
-  this->UpdateWindowLevel();
+  int t = this->mSlicers[slicer]->GetTSlice();
+  if(bCtrlKey && this->mSlicers[slicer]->GetFusion()) {
+    this->mSlicers[slicer]->GetExtremasAroundMousePointer(min, max, this->mSlicers[slicer]->GetFusion()->GetVTKImages()[t]);
+    this->SetFusionWindow(max-min);
+    this->SetFusionLevel(0.5*(min+max));
+    this->SetColorMap(mColorMap);
+  }
+  else if(bCtrlKey && this->mSlicers[slicer]->GetOverlay()) {
+    this->mSlicers[slicer]->GetExtremasAroundMousePointer(min, max, this->mSlicers[slicer]->GetOverlay()->GetVTKImages()[t]);
+    if(this->mSlicers[slicer]->GetLinkOverlayWindowLevel()){
+      this->SetColorWindow(max-min);
+      this->SetColorLevel(0.5*(min+max));
+    } else {
+      this->SetOverlayColorWindow(max-min);
+      this->SetOverlayColorLevel(0.5*(min+max));
+    }
+  }
+  else {
+    this->mSlicers[slicer]->GetExtremasAroundMousePointer(min, max, this->mSlicers[slicer]->GetInput());
+    this->SetColorWindow(max-min);
+    this->SetColorLevel(0.5*(min+max));
+    this->SetPreset(6);
+  }
   this->Render();
+  this->UpdateWindowLevel();
 }
 //----------------------------------------------------------------------------
 
index 5e0ef60c24194669ebf78e5d30a4eb0aa2aca145..e8a229b877d8dc3e9d669c58d429742401e2753d 100644 (file)
@@ -111,7 +111,10 @@ class vvSlicerManager : public QObject {
   void GenerateDefaultLookupTable();
   void SetColorWindow(double s);
   void SetColorLevel(double s);
-  void SetLocalColorWindowing(const int slicer);
+  void SetOverlayColorWindow(double s);
+  void SetOverlayColorLevel(double s);
+  void SetLinkOverlayWindowLevel(bool b);
+  void SetLocalColorWindowing(const int slicer, const bool bCtrlKey);
   void SetOpacity(int i, double factor);
   void SetColorMap(int colormap);
   void SetPreset(int preset);
@@ -136,6 +139,9 @@ class vvSlicerManager : public QObject {
 
   double GetColorWindow();
   double GetColorLevel();
+  double GetOverlayColorWindow();
+  double GetOverlayColorLevel();
+  bool GetLinkOverlayWindowLevel();
   int GetColorMap() {
     return mColorMap;
   }
@@ -145,7 +151,6 @@ class vvSlicerManager : public QObject {
   int GetOverlayColor() {
     return mOverlayColor;
   }
-
   int GetFusionOpacity() {
     return mFusionOpacity;
   }
@@ -216,7 +221,7 @@ signals :
   void UpdateSlice(int slicer, int slice);
   void UpdateTSlice(int slicer, int slice);
   void UpdateSliceRange(int slice, int min, int max, int tmin, int tmax);
-  void WindowLevelChanged(double window, double level, int preset, int colormap);
+  void WindowLevelChanged();
   void UpdateLinkManager(std::string, int slicer, double x, double y, double z, int temps);
   void UpdateLinkedNavigation(std::string, vvSlicerManager*, vvSlicer*);
   void LandmarkAdded();
index 805f51bea4bd943a23abc0ed4399d007b8dd8b8e..1b7103301b7d9f0544c731c14ccca913a623657d 100644 (file)
@@ -109,7 +109,7 @@ void vvSlicerManagerCommand::Execute(vtkObject *caller,
           return;
         }
         if (KeyPress == "w") {
-          this->SM->SetLocalColorWindowing(VisibleInWindow);
+          this->SM->SetLocalColorWindowing(VisibleInWindow, bCtrlKey);
           return;
         }
         if (KeyPress == "0") {
@@ -186,7 +186,6 @@ void vvSlicerManagerCommand::Execute(vtkObject *caller,
           return;
         }
         if (KeyPress == "h") {
-          std::cout << "KeyPress == \"h\"\n";
           this->SM->SetCursorAndCornerAnnotationVisibility(0);
           this->SM->Render();
           return;
@@ -405,8 +404,8 @@ void vvSlicerManagerCommand::Execute(vtkObject *caller,
       this->SM->SetColorWindow(window*dx);
       this->SM->SetColorLevel(level-dy);
       this->SM->SetPreset(6);
-      this->SM->UpdateWindowLevel();
       this->SM->Render();
+      this->SM->UpdateWindowLevel();
       return;
     }
   }