]> Creatis software - clitk.git/commitdiff
Merge branch 'master' into blutdirmaster
authorRomulo Pinho <pinho@lyon.fnclcc.fr>
Tue, 7 Jun 2011 08:04:11 +0000 (10:04 +0200)
committerRomulo Pinho <pinho@lyon.fnclcc.fr>
Tue, 7 Jun 2011 08:04:11 +0000 (10:04 +0200)
18 files changed:
itk/clitkBackProjectImageFilter.h
itk/clitkBackProjectImageFilter.txx
tools/clitkConeBeamProjectImage.ggo
tools/clitkConeBeamProjectImageFilter.h
tools/clitkConeBeamProjectImageFilter.txx
tools/clitkConeBeamProjectImageGenericFilter.cxx
vv/qt_ui/vvHelpDialog.ui
vv/qt_ui/vvOverlayPanel.ui
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
vv/vvToolCreatorBase.cxx

index ebaeffc49fee3ff2c3753d7d8a4d344e6b5c2cf5..7de71a116111326f2bed06060af31bc165a6ecb5 100644 (file)
@@ -148,6 +148,11 @@ namespace clitk
        }
     }
 
+    void SetPanelShift(double x, double y)
+    {
+      m_PanelShift[0] = x;
+      m_PanelShift[1] = y;
+    }
     //     itkSetMacro(IsoCenter, OutputPointType);
     //     itkGetConstReferenceMacro(IsoCenter, OutputPointType)
     //     itkSetMacro( SourceToScreen, double );
@@ -258,6 +263,7 @@ namespace clitk
     double  m_SourceToAxis;
     OutputPixelType m_EdgePaddingValue;
     double m_ProjectionAngle;
+    double m_PanelShift[2];
 
     // Output image info
     OutputSizeType                m_OutputSize;        // Size of the output image
index 65ac8017d4cb98b2009b573f3de03afb07e694db..befc8822013cb8543d7bbc0d3ece59b417f84b31 100644 (file)
@@ -20,6 +20,7 @@
 #include "clitkBackProjectImageFilter.h"
 #include "itkContinuousIndex.h"
 #include "vnl/vnl_math.h"
+#include "itkLinearInterpolateImageFunction.h"
 
 namespace clitk
 {
@@ -39,6 +40,8 @@ namespace clitk
     this->m_SourceToAxis = 1000.0;
     this->m_EdgePaddingValue = itk::NumericTraits<OutputPixelType>::Zero;//density images
     this->m_RigidTransformMatrix.SetIdentity();
+    this->m_PanelShift[0] = 0.;
+    this->m_PanelShift[1] = 0.;
 
     //Parameters for output
     this->m_OutputSpacing.Fill(1);
@@ -304,8 +307,6 @@ namespace clitk
   {
     //Projection pointer
     InputImageConstPointer inputPtr=this->GetInput();
-    InputPixelType * beginPtr=const_cast<InputPixelType *>(this->GetInput()->GetBufferPointer());
-    InputPixelType * pp;
     
     //Volume pointer
     OutputImagePointer outputPTr= this->GetOutput();
@@ -325,8 +326,6 @@ namespace clitk
     OutputIndexType oIndex;
     ContinuousInputIndexType iIndex;
     InputSizeType inputSize=inputPtr->GetLargestPossibleRegion().GetSize();
-    double dx,dy,dxm,dym;
-    int lx, ly;
 
     //Get the first output coordinate
     oIndex=iterator.GetIndex();//costly but only once a thread
@@ -337,9 +336,13 @@ namespace clitk
        
     //Compute the first input coordinate (invert Y/X)
     homInputPoint= (m_ProjectionMatrix * homOutputPoint);
-    iPoint[0]=-homInputPoint[0]/homInputPoint[2];
-    iPoint[1]=homInputPoint[1]/homInputPoint[2];
-    
+    iPoint[0]=-homInputPoint[0]/homInputPoint[2] + m_PanelShift[0];
+    iPoint[1]=homInputPoint[1]/homInputPoint[2] + m_PanelShift[1];
+
+    typedef itk::LinearInterpolateImageFunction< InputImageType, double > InterpolatorType;
+    typename InterpolatorType::Pointer interpolator = InterpolatorType::New();
+    interpolator->SetInputImage(this->GetInput());
+
     //Run over all output voxels
     for (unsigned int i=0; i<outputSizeForThread[2]; i++)
       {
@@ -347,25 +350,15 @@ namespace clitk
          {
            for (unsigned int k=0; k<outputSizeForThread[0]; k++)
              {
-               iPoint[0]=homInputPoint[0]/homInputPoint[2];
-               iPoint[1]=homInputPoint[1]/homInputPoint[2];
+               iPoint[0]=-homInputPoint[0]/homInputPoint[2] + m_PanelShift[0];
+               iPoint[1]=homInputPoint[1]/homInputPoint[2] + m_PanelShift[1];
 
                //Check wether inside, convert to index (use modified with correct origin)
-               if( m_ModifiedInput->TransformPhysicalPointToContinuousIndex(iPoint, iIndex) )
-                 {
-                   //Own (fast bilinear) interpolation   
-                   lx = (int)floor(iIndex[0]); dx = iIndex[0]-lx; dxm = 1.-dx;
-                   ly = (int)floor(iIndex[1]); dy = iIndex[1]-ly; dym = 1.-dy;
-                   pp = beginPtr + ly*inputSize[0]+lx;
-                   value =static_cast<OutputPixelType>( ( dxm  * dym*(double)(*pp) 
-                                                          + dx * dym*(double)(*(pp+1)) 
-                                                          + dxm* dy *(double)(*(pp + inputSize[0]))
-                                                          + dx * dy *(double)(*(pp + inputSize[0]+1))) );
-           
-                 }
+               if (m_ModifiedInput->TransformPhysicalPointToContinuousIndex(iPoint, iIndex) && interpolator->IsInsideBuffer(iIndex))
+                    value = interpolator->EvaluateAtContinuousIndex(iIndex);
                //Outside: padding value
-               else value=m_EdgePaddingValue;
-               
+               else
+                  value=m_EdgePaddingValue;
                //Set it
                iterator.Set(value);
 
index 1c77551e0500be7c8b9601d67d1610b4c9a99fa1..4e80707a030803ce6c948b65206f792938c462fa 100644 (file)
@@ -35,4 +35,4 @@ option "size"                 -       "Size for the output image"                     int             multiple no     default="512"
 option "spacing"               -       "Spacing for the output image"                  double          multiple no     default="0.8"       
 
 option "panel_position"         -       "Approximate position of the panel: small, medium or large"     string          no              default="small"
-option "panel_shift"            -       "Precise position of the panel in mm"           double          no
+option "panel_shift"            -       "Precise position of the panel in mm"           double          multiple        no
index fcf8610c5798ab471583a69aa751316ce1e3682f..2363a5f1a3882567f5eaa926adf7d19c7b34abce 100644 (file)
@@ -188,11 +188,16 @@ namespace clitk
     }
 
     /** Set the panelshift. */
-    void SetPanelShift(double shift)
+    void SetPanelShift(double x, double y)
     {
-      if (m_PanelShift!=shift)
+      if (m_PanelShift[0] != x)
        {
-         m_PanelShift=shift;
+         m_PanelShift[0] = x;
+         m_IsInitialized=false;
+       }
+      if (m_PanelShift[1] != y)
+       {
+         m_PanelShift[1] = y;
          m_IsInitialized=false;
        }
     }
@@ -229,7 +234,7 @@ namespace clitk
     double m_SourceToScreen;
     double m_SourceToAxis;
     double m_ProjectionAngle;
-    double m_PanelShift;
+    double m_PanelShift[2];
     MatrixType m_RigidTransformMatrix;
     OutputPixelType m_EdgePaddingValue;
 
index dfc889827dfab2865ec6914910f0dad0763047b2..798fbd1c5bd10b83e5d5b8994ef8da36bf62e7e3 100644 (file)
@@ -36,6 +36,8 @@ namespace clitk
     m_IsoCenter.Fill(0.0);
     m_SourceToScreen=1536.;
     m_SourceToAxis=1000.;
+    m_PanelShift[0] = 0.;
+    m_PanelShift[1] = 0.;
     m_ProjectionAngle=0.;
     m_RigidTransformMatrix.SetIdentity();
     m_EdgePaddingValue=itk::NumericTraits<OutputPixelType>::Zero;//density images
@@ -163,15 +165,15 @@ namespace clitk
     spacingOutput[1] = m_OutputSpacing[0];  // pixel spacing along Y of the 2D DRR image [mm]
     spacingOutput[2] = m_OutputSpacing[1];  // pixel spacing along Y of the 2D DRR image [mm]
     m_Resampler->SetOutputSpacing( spacingOutput );
-    if (m_Verbose)std::cout<<"The output size is "<< m_OutputSpacing <<"..."<< std::endl;
+    if (m_Verbose)std::cout<<"The output spacing is "<< m_OutputSpacing <<"..."<< std::endl;
 
     // The position of the DRR is specified, we presume that for an angle of 0° the flatpanel is located at the negative x-axis
     // JV -1 seems to correspond better with shearwarp of Simon Rit
     typename  InterpolatorType::InputPointType originOutput;
     originOutput[0] = m_IsoCenter[0]- (m_SourceToScreen - m_SourceToAxis);
     DD(m_PanelShift);
-    originOutput[1] = m_IsoCenter[1]-static_cast<double>(sizeOuput[1]-1)*spacingOutput[1]/2.0 - m_PanelShift;
-    originOutput[2] = m_IsoCenter[2]-static_cast<double>(sizeOuput[2]-1)*spacingOutput[2]/2.0
+    originOutput[1] = m_IsoCenter[1]-static_cast<double>(sizeOuput[1]-1)*spacingOutput[1]/2.0 - m_PanelShift[0];
+    originOutput[2] = m_IsoCenter[2]-static_cast<double>(sizeOuput[2]-1)*spacingOutput[2]/2.0 - m_PanelShift[1];
     m_Resampler->SetOutputOrigin( originOutput );
     if (m_Verbose)std::cout<<"The origin of the flat panel is at "<< originOutput <<",..."<< std::endl;
 
index d659b969f8e2f48a75eb30ed8724eb1dc72d1ec2..e36b7d1b1febafabe4843a7a627516292d5ba2ea 100644 (file)
@@ -133,14 +133,14 @@ namespace clitk
 
     DD(m_ArgsInfo.panel_position_arg);
     if (m_ArgsInfo.panel_shift_given) // one should read the specific values for each angle in Frame.dbf
-      filter->SetPanelShift(m_ArgsInfo.panel_shift_arg);
+      filter->SetPanelShift(m_ArgsInfo.panel_shift_arg[0], m_ArgsInfo.panel_shift_arg[1]);
     else { // approximate panel positions hard coded values for the elekta synergy
       if (strcmp(m_ArgsInfo.panel_position_arg,"small") ==0)
-        filter->SetPanelShift(0.);
+        filter->SetPanelShift(0., 0.);
       else if (strcmp(m_ArgsInfo.panel_position_arg,"medium") ==0)
-        filter->SetPanelShift(114.84);
+        filter->SetPanelShift(114.84, 0.); // VD : 120 , 0 ?
       else if (strcmp(m_ArgsInfo.panel_position_arg,"large") ==0)
-        filter->SetPanelShift(190.);
+        filter->SetPanelShift(190., 0.);
       else assert(false); //Unsupported panel position
     }
     // Output image info
index 303a665961753183f141624ae79af50d27d487bf..2917b136dad1aba84f047f5943ce6dc407a213e0 100644 (file)
@@ -65,7 +65,7 @@ p, li { white-space: pre-wrap; }
         <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;space&lt;/span&gt;&lt;span style=&quot; font-size:12pt;&quot;&gt;: Landmark&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; text-decoration: underline;&quot;&gt;Navigation&lt;/span&gt;&lt;/p&gt;
@@ -74,6 +74,7 @@ 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;u&lt;/span&gt;&lt;span style=&quot; font-size:12pt;&quot;&gt;: &lt;/span&gt;&lt;span style=&quot; font-size:12pt; text-decoration: underline;&quot;&gt;U&lt;/span&gt;&lt;span style=&quot; font-size:12pt;&quot;&gt;pdate Image&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;f&lt;/span&gt;&lt;span style=&quot; font-size:12pt;&quot;&gt;: &lt;/span&gt;&lt;span style=&quot; font-size:12pt; text-decoration: underline;&quot;&gt;F&lt;/span&gt;&lt;span style=&quot; font-size:12pt;&quot;&gt;ly To Mouse Position&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;g&lt;/span&gt;&lt;span style=&quot; font-size:12pt;&quot;&gt;: &lt;/span&gt;&lt;span style=&quot; font-size:12pt; text-decoration: underline;&quot;&gt;G&lt;/span&gt;&lt;span style=&quot; font-size:12pt;&quot;&gt;o to Crosshair Position&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;o&lt;/span&gt;&lt;span style=&quot; font-size:12pt;&quot;&gt;: Go to Image &lt;/span&gt;&lt;span style=&quot; font-size:12pt; text-decoration: underline;&quot;&gt;O&lt;/span&gt;&lt;span style=&quot; font-size:12pt;&quot;&gt;rigin&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;h&lt;/span&gt;&lt;span style=&quot; font-size:12pt;&quot;&gt;: &lt;/span&gt;&lt;span style=&quot; font-size:12pt; text-decoration: underline;&quot;&gt;H&lt;/span&gt;&lt;span style=&quot; font-size:12pt;&quot;&gt;ide Crosshair and corner annotations&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;Up,Down&lt;/span&gt;&lt;span style=&quot; font-size:12pt;&quot;&gt;: Change Slice&lt;/span&gt;&lt;/p&gt;
index 60a6803859eb98011b98a10c9cd2961e5c7ac997..af07fe8fd0f35a7a215193857ed36dad2ea0022f 100644 (file)
@@ -6,8 +6,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>323</width>
-    <height>447</height>
+    <width>342</width>
+    <height>480</height>
    </rect>
   </property>
   <property name="sizePolicy">
@@ -171,12 +171,12 @@ p, li { white-space: pre-wrap; }
         </item>
         <item>
          <widget class="QToolButton" name="vfColorButton">
-           <property name="styleSheet">
-            <string>
+          <property name="styleSheet">
+           <string>
               background-color: rgb(0, 255, 0);
               border: 0px;
             </string>
-           </property>
+          </property>
          </widget>
         </item>
        </layout>
@@ -330,13 +330,7 @@ p, li { white-space: pre-wrap; }
      <property name="frameShadow">
       <enum>QFrame::Raised</enum>
      </property>
-     <layout class="QGridLayout">
-      <property name="margin">
-       <number>2</number>
-      </property>
-      <property name="spacing">
-       <number>2</number>
-      </property>
+     <layout class="QGridLayout" name="gridLayout">
       <item row="0" column="0">
        <widget class="QLabel" name="label_5">
         <property name="maximumSize">
@@ -353,7 +347,7 @@ p, li { white-space: pre-wrap; }
         </property>
        </widget>
       </item>
-      <item row="0" column="1" colspan="4">
+      <item row="0" column="1" colspan="2">
        <widget class="QLabel" name="dataFusionnedLabel">
         <property name="sizePolicy">
          <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
@@ -366,14 +360,14 @@ p, li { white-space: pre-wrap; }
         </property>
        </widget>
       </item>
-      <item row="1" column="0" colspan="2">
+      <item row="1" column="0" colspan="3">
        <widget class="QLabel" name="opacityLabel">
         <property name="text">
-         <string>Opacity :</string>
+         <string>Global Opacity :</string>
         </property>
        </widget>
       </item>
-      <item row="1" column="2" colspan="3">
+      <item row="1" column="3" colspan="3">
        <widget class="QSlider" name="opacityHorizontalSlider">
         <property name="sizePolicy">
          <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
@@ -386,7 +380,36 @@ p, li { white-space: pre-wrap; }
         </property>
        </widget>
       </item>
-      <item row="2" column="0" colspan="2">
+      <item row="2" column="0" colspan="3">
+       <widget class="QLabel" name="thresOpacityLabel">
+        <property name="toolTip">
+         <string>All colors below the threshold will be made transparent.</string>
+        </property>
+        <property name="statusTip">
+         <string/>
+        </property>
+        <property name="whatsThis">
+         <string/>
+        </property>
+        <property name="text">
+         <string>Transparency Threshold :</string>
+        </property>
+       </widget>
+      </item>
+      <item row="2" column="3" colspan="3">
+       <widget class="QSlider" name="thresOpacityHorizontalSlider">
+        <property name="sizePolicy">
+         <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+          <horstretch>0</horstretch>
+          <verstretch>0</verstretch>
+         </sizepolicy>
+        </property>
+        <property name="orientation">
+         <enum>Qt::Horizontal</enum>
+        </property>
+       </widget>
+      </item>
+      <item row="3" column="0" colspan="2">
        <widget class="QLabel" name="label_6">
         <property name="sizePolicy">
          <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
@@ -399,10 +422,10 @@ p, li { white-space: pre-wrap; }
         </property>
        </widget>
       </item>
-      <item row="2" column="2" colspan="2">
+      <item row="3" column="2" colspan="2">
        <widget class="QComboBox" name="fusionColorMapComboBox">
         <property name="currentIndex">
-         <number>3</number>
+         <number>0</number>
         </property>
         <item>
          <property name="text">
@@ -419,6 +442,11 @@ p, li { white-space: pre-wrap; }
           <string>Cold</string>
          </property>
         </item>
+        <item>
+         <property name="text">
+          <string>Dosimetry</string>
+         </property>
+        </item>
         <item>
          <property name="text">
           <string>Full Color Range</string>
@@ -426,14 +454,14 @@ p, li { white-space: pre-wrap; }
         </item>
        </widget>
       </item>
-      <item row="3" column="0" colspan="2">
+      <item row="4" column="0" colspan="2">
        <widget class="QLabel" name="label_7">
         <property name="text">
          <string>Window :</string>
         </property>
        </widget>
       </item>
-      <item row="3" column="2">
+      <item row="4" column="2" colspan="2">
        <widget class="QDoubleSpinBox" name="windowSpinBox">
         <property name="decimals">
          <number>4</number>
@@ -452,14 +480,14 @@ p, li { white-space: pre-wrap; }
         </property>
        </widget>
       </item>
-      <item row="3" column="3">
+      <item row="4" column="4">
        <widget class="QLabel" name="label_8">
         <property name="text">
          <string>Level :</string>
         </property>
        </widget>
       </item>
-      <item row="3" column="4">
+      <item row="4" column="5">
        <widget class="QDoubleSpinBox" name="levelSpinBox">
         <property name="decimals">
          <number>4</number>
@@ -478,7 +506,7 @@ p, li { white-space: pre-wrap; }
         </property>
        </widget>
       </item>
-      <item row="4" column="0" colspan="5">
+      <item row="5" column="0" colspan="3">
        <widget class="QLabel" name="valueFusionnedLabel">
         <property name="sizePolicy">
          <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
index 8a0bd2472bb4e1c86b1f8b7cc6356e79b7ce9896..c60c04da4771dd2c4ec64c753449161ae410189c 100644 (file)
@@ -290,8 +290,8 @@ vvMainWindow::vvMainWindow():vvMainWindowBase()
   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(FusionPropertyUpdated(int,int,double,double)),
-          this,SLOT(SetFusionProperty(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()));
 
   playMode = 0;//pause
@@ -865,6 +865,7 @@ void vvMainWindow::LoadImages(std::vector<std::string> files, vvImageReader::Loa
         item->setData(0,Qt::UserRole,files[i].c_str());
         QFileInfo fileinfo(imageManager->GetFileName().c_str()); //Do not show the path
         item->setData(COLUMN_IMAGE_NAME,Qt::DisplayRole,fileinfo.fileName());
+        item->setData(1,Qt::UserRole,tr("image"));
         item->setToolTip(COLUMN_IMAGE_NAME, imageManager->GetListOfAbsoluteFilePathInOneString("image").c_str());
         qApp->processEvents();
 
@@ -1167,12 +1168,13 @@ void vvMainWindow::ImageInfoChanged()
     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);
+      overlayPanel->getFusionProperty(-1, -1, -1, -1, -1);
     }
   }
 }
@@ -1340,75 +1342,71 @@ QTreeWidgetItem* vvMainWindow::GetItemFromSlicerManager(vvSlicerManager* sm)
 //------------------------------------------------------------------------------
 
 //------------------------------------------------------------------------------
-void vvMainWindow::DisplayChanged(QTreeWidgetItem *clicked_item, int column)
+void vvMainWindow::DisplayChanged(QTreeWidgetItem *clickedItem, int column)
 {
-  int index = GetSlicerIndexFromItem(clicked_item);
   if ( column >= COLUMN_CLOSE_IMAGE || column <= 0)
     return;
+
+  // Get parent information (might be the same item)
+  int slicerManagerIndex = GetSlicerIndexFromItem(clickedItem);
+  QTreeWidgetItem* clickedParentItem = DataTree->topLevelItem(slicerManagerIndex);
+  vvSlicer* clickedSlicer = mSlicerManagers[slicerManagerIndex]->GetSlicer(column-1);
+
+  // Go over the complete item tree (only 2 levels, parents and children)
   for (unsigned int i = 0; i < mSlicerManagers.size(); i++) {
-    //Trick to avoid redoing twice the job for a key (sr)
-    mSlicerManagers[i]->GetSlicer(column-1)->GetRenderWindow()-> GetInteractor()->SetKeySym("Crap");
-
-    QTreeWidgetItem* current_row=DataTree->topLevelItem(i);
-    if (DataTree->topLevelItem(index) == current_row) {
-      vvSlicer* clicked_slicer=mSlicerManagers[i]->GetSlicer(column-1);
-      if (current_row == clicked_item) {
-        //If we just activated a slicer
-        if (current_row->data(column,Qt::CheckStateRole).toInt() > 0) {
-          mSlicerManagers[i]->UpdateSlicer(column-1,clicked_item->data(column,Qt::CheckStateRole).toInt());
-          mSlicerManagers[i]->UpdateInfoOnCursorPosition(column-1);
-          DisplaySliders(i,column-1);
-          std::map<std::string,int> overlay_counts;
-          for (int child = 0; child < current_row->childCount(); child++) {
-            std::string overlay_type =
-              current_row->child(child)->data(1,Qt::UserRole).toString().toStdString();
-            overlay_counts[overlay_type]++;
-            current_row->child(child)->setData(column,Qt::CheckStateRole,
-                                               current_row->data(column,Qt::CheckStateRole));
-            clicked_slicer->SetActorVisibility(overlay_type,overlay_counts[overlay_type]-1,true);
-          }
-        } else { //We don't allow simply desactivating a slicer
-          clicked_item->setData(column,Qt::CheckStateRole,2);
-          DisplayChanged(clicked_item, column);
-          return;
-        }
+    // Trick to avoid redoing twice the job for a key (sr)
+    mSlicerManagers[i]->GetSlicer(column-1)->GetRenderWindow()->GetInteractor()->SetKeySym("Crap");
+
+    QTreeWidgetItem* currentParentItem = DataTree->topLevelItem(i);
+    if(currentParentItem != clickedParentItem) {
+      // Not the branch of the clicked item, uncheck all
+
+      // Parent
+      currentParentItem->setData(column,Qt::CheckStateRole, 0);
+      mSlicerManagers[i]->UpdateSlicer(column-1, false);
+
+      // Children
+      for (int iChild = 0; iChild < currentParentItem->childCount(); iChild++) {
+        currentParentItem->child(iChild)->setData(column,Qt::CheckStateRole, 0);
       }
-      //if we clicked on the vector(or overlay) and not the image
-      else {
-        if (clicked_item->data(column,Qt::CheckStateRole).toInt()) {
-          current_row->setData(column,Qt::CheckStateRole,2);
-          mSlicerManagers[i]->UpdateSlicer(column-1,2);
-          mSlicerManagers[i]->UpdateInfoOnCursorPosition(column-1);
-          DisplaySliders(i,column-1);
-        }
-        int vis = clicked_item->data(column,Qt::CheckStateRole).toInt();
-        std::string overlay_type = clicked_item->data(1,Qt::UserRole).toString().toStdString();
-        int overlay_index=0;
-        for (int child = 0; child < current_row->childCount(); child++) {
-          if (current_row->child(child)->data(1,Qt::UserRole).toString().toStdString() == overlay_type)
-            overlay_index++;
-          if (current_row->child(child) == clicked_item) break;
-        }
-        clicked_slicer->SetActorVisibility(
-          clicked_item->data(1,Qt::UserRole).toString().toStdString(), overlay_index-1,vis);
+    }
+    else {
+      // Branch of the clicked one: get check status from actor visibility in slicer
+      // and toggle the clicked one
+
+      // Parent
+      bool vis = clickedSlicer->GetActorVisibility("image", 0);
+      bool draw = clickedSlicer->GetRenderer()->GetDraw();
+
+      // Update slicer (after getting visibility)
+      mSlicerManagers[slicerManagerIndex]->UpdateSlicer(column-1, true);
+      mSlicerManagers[slicerManagerIndex]->UpdateInfoOnCursorPosition(column-1);
+      DisplaySliders(slicerManagerIndex, column-1);
+      if(clickedParentItem == clickedItem) {
+        // Toggle
+        vis = !draw || !vis;
       }
-    } else if (current_row->data(column,Qt::CheckStateRole).toInt() > 0) {
-      current_row->setData(column,Qt::CheckStateRole,0);
-      mSlicerManagers[i]->UpdateSlicer(column-1,0);
-      std::map<std::string,int> overlay_counts;
-      for (int child = 0; child < current_row->childCount(); child++) {
-        std::string overlay_type =
-          current_row->child(child)->data(1,Qt::UserRole).toString().toStdString();
-        overlay_counts[overlay_type]++;
-        current_row->child(child)->setData(column,Qt::CheckStateRole,0);
-        vvSlicer * current_slicer=mSlicerManagers[i]->GetSlicer(column-1);
-        current_slicer->SetActorVisibility(overlay_type,overlay_counts[overlay_type]-1,false);
+      clickedSlicer->SetActorVisibility("image", 0, vis);
+      clickedParentItem->setData(column, Qt::CheckStateRole, vis?2:0);
+
+      // Children
+      std::map<std::string, int> actorTypeCounts;      
+      for (int iChild = 0; iChild < clickedParentItem->childCount(); iChild++) {
+        QTreeWidgetItem* currentChildItem = clickedParentItem->child(iChild);
+        std::string actorType = currentChildItem->data(1,Qt::UserRole).toString().toStdString();
+        vis = clickedSlicer->GetActorVisibility(actorType, actorTypeCounts[actorType]);
+        if(currentChildItem == clickedItem) {
+          // Toggle or force visibility if it was not on this branch so far
+          vis = !draw || !vis;
+          clickedSlicer->SetActorVisibility(actorType, actorTypeCounts[actorType], vis);
+        }
+        currentChildItem->setData(column, Qt::CheckStateRole, vis?2:0);
+        actorTypeCounts[actorType]++;
       }
     }
-    //mSlicerManagers[i]->SetColorMap(-1);
-    mSlicerManagers[i]->SetColorMap();
   }
-  mSlicerManagers[index]->GetSlicer(column-1)->Render();
+
+  clickedSlicer->Render();
 }
 //------------------------------------------------------------------------------
 
@@ -1821,8 +1819,6 @@ void vvMainWindow::AddOverlayImage(int index, QString file)
 
     for (int j = 1; j <= 4; j++) {
       item->setData(j,Qt::CheckStateRole,DataTree->topLevelItem(index)->data(j,Qt::CheckStateRole));
-      mSlicerManagers[index]->GetSlicer(j-1)->SetActorVisibility("overlay",0,
-          DataTree->topLevelItem(index)->data(j,Qt::CheckStateRole).toInt());
     }
 
     //Create the buttons for reload and close
@@ -1943,8 +1939,6 @@ void vvMainWindow::AddFusionImage(int index, QString file)
 
       for (int j = 1; j <= 4; j++) {
         item->setData(j,Qt::CheckStateRole,DataTree->topLevelItem(index)->data(j,Qt::CheckStateRole));
-        mSlicerManagers[index]->GetSlicer(j-1)->SetActorVisibility("fusion",0,
-            DataTree->topLevelItem(index)->data(j,Qt::CheckStateRole).toInt());
       }
 
       //Create the buttons for reload and close
@@ -2028,8 +2022,6 @@ void vvMainWindow::AddFieldEntry(QString filename,int index,bool from_disk)
 
   for (int j = 1; j <= 4; j++) {
     item->setData(j,Qt::CheckStateRole,DataTree->topLevelItem(index)->data(j,Qt::CheckStateRole));
-    mSlicerManagers[index]->GetSlicer(j-1)->SetActorVisibility("vector",0,
-        DataTree->topLevelItem(index)->data(j,Qt::CheckStateRole).toInt());
   }
 
   //Create the buttons for reload and close
@@ -2149,11 +2141,12 @@ void vvMainWindow::SetOverlayProperty(int color)
 //------------------------------------------------------------------------------
 
 //------------------------------------------------------------------------------
-void vvMainWindow::SetFusionProperty(int opacity, int colormap,double window, double level)
+void vvMainWindow::SetFusionProperty(int opacity, int thresOpacity, int colormap,double window, double level)
 {
   int index = GetSlicerIndexFromItem(DataTree->selectedItems()[0]);
   if (mSlicerManagers[index]->GetSlicer(0)->GetFusion()) {
     mSlicerManagers[index]->SetFusionOpacity(opacity);
+    mSlicerManagers[index]->SetFusionThresholdOpacity(thresOpacity);
     mSlicerManagers[index]->SetFusionColorMap(colormap);
     mSlicerManagers[index]->SetFusionWindow(window);
     mSlicerManagers[index]->SetFusionLevel(level);
@@ -2790,6 +2783,7 @@ vvSlicerManager* vvMainWindow::AddImage(vvImage::Pointer image,std::string filen
   //create an item in the tree with good settings
   QTreeWidgetItem *item = new QTreeWidgetItem();
   item->setData(0,Qt::UserRole,slicer_manager->GetFileName().c_str());//files[i].c_str());
+  item->setData(1,Qt::UserRole,tr("image"));
   item->setData(COLUMN_IMAGE_NAME,Qt::DisplayRole,slicer_manager->GetFileName().c_str());//filename.c_str());
   qApp->processEvents();
 
index 35a5d90adbf2f2ca0ce3a4b6be77e0f60d4f5475..d47dacce49a837b32d8dc2cd7877bc3cdfad7fff 100644 (file)
@@ -143,7 +143,7 @@ public slots:
 
   void SetVFProperty(int subsampling,int scale,int lut, int width, double r, double g, double b);
   void SetOverlayProperty(int color);
-  void SetFusionProperty(int opacity,int colormap,double window,double level);
+  void SetFusionProperty(int opacity, int tresOpacity, int colormap,double window,double level);
 
   void GoToCursor();
   void PlayPause();
index 843e46d97598b54f108b0f1bfdd6dcae10c02315..f19e13b0cc167325b3b9b87826a91ac3a098ead9 100644 (file)
@@ -45,6 +45,7 @@ vvOverlayPanel::vvOverlayPanel(QWidget * parent):QWidget(parent)
   connect(vfColorButton,SIGNAL(clicked()),this,SLOT(VFColorChangeRequest()));
   connect(colorHorizontalSlider,SIGNAL(valueChanged(int)),this,SLOT(setOverlayProperty()));
   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()));
@@ -163,13 +164,15 @@ void vvOverlayPanel::getFusionName(QString name)
   dataFusionnedLabel->setText(filename.toStdString().c_str());
 }
 
-void vvOverlayPanel::getFusionProperty(int opacity, int colormap, double window, double level)
+void vvOverlayPanel::getFusionProperty(int opacity, int thresOpacity, int colormap, double window, double level)
 {
   if (opacity > -1) {
     fusionFrame->show();
     fusionFrame->setEnabled(1);
     opacityHorizontalSlider->setEnabled(1);
     opacityHorizontalSlider->setValue(opacity);
+    thresOpacityHorizontalSlider->setEnabled(1);
+    thresOpacityHorizontalSlider->setValue(thresOpacity);
     fusionColorMapComboBox->setEnabled(1);
     fusionColorMapComboBox->setCurrentIndex(colormap);
     windowSpinBox->setEnabled(1);
@@ -181,6 +184,8 @@ void vvOverlayPanel::getFusionProperty(int opacity, int colormap, double window,
     fusionFrame->setEnabled(0);
     opacityHorizontalSlider->setEnabled(0);
     opacityHorizontalSlider->setValue(0);
+    thresOpacityHorizontalSlider->setEnabled(0);
+    thresOpacityHorizontalSlider->setValue(0);
     fusionColorMapComboBox->setEnabled(0);
     fusionColorMapComboBox->setCurrentIndex(-1);
     windowSpinBox->setEnabled(0);
@@ -190,7 +195,7 @@ void vvOverlayPanel::getFusionProperty(int opacity, int colormap, double window,
 
 void vvOverlayPanel::setFusionProperty()
 {
-  emit FusionPropertyUpdated(opacityHorizontalSlider->value(), fusionColorMapComboBox->currentIndex(),
+  emit FusionPropertyUpdated(opacityHorizontalSlider->value(), thresOpacityHorizontalSlider->value(), fusionColorMapComboBox->currentIndex(),
                              windowSpinBox->value(), levelSpinBox->value());
 }
 
index 0b867bc27a2458d5d3fb060a07663609a4d201ee..ef0dcf1f352178b5bf9d16c194a0d0ca359f9d42 100644 (file)
@@ -41,7 +41,7 @@ public:
     void getOverlayProperty(int color);
     void getOverlayName(QString name);
 
-    void getFusionProperty(int opacity, int colormap, double window, double level);
+    void getFusionProperty(int opacity, int thresOpacity, int colormap, double window, double level);
     void getFusionName(QString name);
 
     void getCurrentVectorInfo(int visibility, double x, double y, double z, double value);
@@ -57,7 +57,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 FusionPropertyUpdated(int opacity, int colormap, double window, double level);
+    void FusionPropertyUpdated(int opacity, int thresOpacity, int colormap, double window, double level);
 }; // end class vvOverlayPanel
 //====================================================================
 
index c9d9be21d9e64d3f3227d313879a9f91f4e391bb..43583571456b3d12d6253bc27e7fb17449eb893a 100644 (file)
@@ -172,7 +172,7 @@ vvBlendImageActor* vvSlicer::GetOverlayActor()
 
 
 //------------------------------------------------------------------------------
-vtkImageMapToWindowLevelColors* vvSlicer::GetFusionMapper()
+vtkImageMapToColors* vvSlicer::GetFusionMapper()
 {
   return mFusionMapper.GetPointer();
 }
@@ -372,7 +372,7 @@ void vvSlicer::SetOverlay(vvImage::Pointer overlay)
       mOverlayActor = vtkSmartPointer<vvBlendImageActor>::New();
       mOverlayActor->SetInput(mOverlayMapper->GetOutput());
       mOverlayActor->SetPickable(0);
-      mOverlayActor->SetVisibility(false);
+      mOverlayActor->SetVisibility(true);
       mOverlayActor->SetOpacity(0.5);
     }
 
@@ -408,14 +408,21 @@ void vvSlicer::SetFusion(vvImage::Pointer fusion)
     mFusionReslice->SetInput(0, mFusion->GetFirstVTKImageData());
 
     if (!mFusionMapper)
-      mFusionMapper = vtkSmartPointer<vtkImageMapToWindowLevelColors>::New();
+      mFusionMapper = vtkSmartPointer<vtkImageMapToColors>::New();
+    
+    vtkSmartPointer<vtkLookupTable> lut = vtkLookupTable::New();
+    lut->SetRange(0, 1);
+    lut->SetValueRange(0, 1);
+    lut->SetSaturationRange(0, 0);
+    lut->Build();
+    mFusionMapper->SetLookupTable(lut);
     mFusionMapper->SetInput(mFusionReslice->GetOutput());
 
     if (!mFusionActor) {
       mFusionActor = vtkSmartPointer<vtkImageActor>::New();
       mFusionActor->SetInput(mFusionMapper->GetOutput());
       mFusionActor->SetPickable(0);
-      mFusionActor->SetVisibility(false);
+      mFusionActor->SetVisibility(true);
       mFusionActor->SetOpacity(0.7);
       this->GetRenderer()->AddActor(mFusionActor);
     }
@@ -428,25 +435,50 @@ void vvSlicer::SetFusion(vvImage::Pointer fusion)
 //------------------------------------------------------------------------------
 
 
+//------------------------------------------------------------------------------
+bool vvSlicer::GetActorVisibility(const std::string& actor_type, int overlay_index)
+{
+  bool vis = false;
+  if (actor_type == "image") {
+    vis = this->ImageActor->GetVisibility();
+  }
+  else if (actor_type == "vector") {
+    vis = this->mVFActor->GetVisibility();
+  }
+  else if (actor_type == "overlay") {
+    vis = this->mOverlayActor->GetVisibility();
+  }
+  else if (actor_type == "fusion") {
+    vis = this->mFusionActor->GetVisibility();
+  }
+  else if (actor_type == "contour")
+    vis = this->mSurfaceCutActors[overlay_index]->GetActor()->GetVisibility();
+
+  return vis;
+}
+//------------------------------------------------------------------------------
+
 //------------------------------------------------------------------------------
 void vvSlicer::SetActorVisibility(const std::string& actor_type, int overlay_index ,bool vis)
 {
-  if (actor_type == "vector") {
+  if (actor_type == "image") {
+    this->ImageActor->SetVisibility(vis);
+  }
+  else if (actor_type == "vector") {
     this->mVFActor->SetVisibility(vis);
   }
-  if (actor_type == "overlay") {
+  else if (actor_type == "overlay") {
     this->mOverlayActor->SetVisibility(vis);
   }
-  if (actor_type == "fusion") {
+  else if (actor_type == "fusion") {
     this->mFusionActor->SetVisibility(vis);
   }
-  if (actor_type == "contour")
+  else if (actor_type == "contour")
     this->mSurfaceCutActors[overlay_index]->GetActor()->SetVisibility(vis);
   UpdateDisplayExtent();
 }
 //------------------------------------------------------------------------------
 
-
 //------------------------------------------------------------------------------
 void vvSlicer::SetVF(vvImage::Pointer vf)
 {
@@ -1027,12 +1059,7 @@ void vvSlicer::ResetCamera()
 //----------------------------------------------------------------------------
 void vvSlicer::SetDisplayMode(bool i)
 {
-  this->GetImageActor()->SetVisibility(i);
-  this->GetAnnotation()->SetVisibility(i);
   this->GetRenderer()->SetDraw(i);
-  if (mLandActor)
-    mLandActor->SetVisibility(i);
-  pdmA->SetVisibility(i);
   if (i)
     UpdateDisplayExtent();
 }
@@ -1216,7 +1243,9 @@ void vvSlicer::Render()
       int ix, iy, iz;
       double value = this->GetScalarComponentAsDouble(this->GetInput(), X, Y, Z, ix, iy, iz);
 
-      worldPos << "data value : " << value << std::endl;
+      if(ImageActor->GetVisibility())
+        worldPos << "data value : " << value << std::endl;
+
       worldPos << "mm : " << lrint(mCurrent[0]) << ' '
                           << lrint(mCurrent[1]) << ' '
                           << lrint(mCurrent[2]) << ' '
@@ -1276,13 +1305,11 @@ void vvSlicer::Render()
 //----------------------------------------------------------------------------
 void vvSlicer::UpdateCursorPosition()
 {
-  if (this->GetImageActor()->GetVisibility()) {
-    pdmA->SetVisibility(true);
-    mCursor[0] = mCurrent[0];
-    mCursor[1] = mCurrent[1];
-    mCursor[2] = mCurrent[2];
-    mCursor[3] = mCurrentTSlice;
-  }
+  pdmA->SetVisibility(true);
+  mCursor[0] = mCurrent[0];
+  mCursor[1] = mCurrent[1];
+  mCursor[2] = mCurrent[2];
+  mCursor[3] = mCurrentTSlice;
 }
 //----------------------------------------------------------------------------
 
index 95ec75e80438d4b5d4e6185f2bca504fc31c09fb..0536bc1e7ef38995f20918af8d53d9b0c73b93be 100644 (file)
@@ -28,6 +28,7 @@
 #include <vtkSmartPointer.h>
 #include <vtkImageViewer2.h>
 #include <vtkImageReslice.h>
+#include <vtkImageMapToColors.h>
 
 class vtkActor;
 class vtkActor2D;
@@ -70,7 +71,7 @@ public:
   }
   vtkImageMapToWindowLevelColors* GetOverlayMapper(); 
   vvBlendImageActor* GetOverlayActor() ;
-  vtkImageMapToWindowLevelColors* GetFusionMapper() ;
+  vtkImageMapToColors* GetFusionMapper() ;
   vtkImageActor* GetFusionActor() ;
   vtkActor* GetVFActor() ;
   vtkCornerAnnotation* GetAnnotation();
@@ -80,9 +81,10 @@ public:
     return mFusion;
   }
 
-  /**Set an actor's visibility ("overlay, fusion, vf, contour...")
+  /**Get/Set an actor's visibility ("overlay, fusion, vf, contour...")
      Overlay index is the index of the overlay by type, eg. if there are
      5 contours and we want to activate the 3rd one, pass 2 **/
+  bool GetActorVisibility(const std::string& actor_type, int overlay_index);
   void SetActorVisibility(const std::string& actor_type, int overlay_index,bool vis);
   void RemoveActor(const std::string& actor_type, int overlay_index);
 
@@ -200,7 +202,7 @@ protected:
   vtkSmartPointer<vtkImageMapToWindowLevelColors> mOverlayMapper;
   vtkSmartPointer<vvBlendImageActor> mOverlayActor;
   vtkSmartPointer<vtkImageReslice> mFusionReslice;
-  vtkSmartPointer<vtkImageMapToWindowLevelColors> mFusionMapper;
+  vtkSmartPointer<vtkImageMapToColors> mFusionMapper;
   vtkSmartPointer<vtkImageActor> mFusionActor;
   vtkSmartPointer<vtkCornerAnnotation> ca;
   vtkSmartPointer<vtkCursor2D> crossCursor;
index 7bf8ed655cf457923c09d46307a46ecfe2cf0e76..871c818a64acf3083e4706a5519ce56ae5d6eb33 100644 (file)
@@ -58,6 +58,7 @@ vvSlicerManager::vvSlicerManager(int numberOfSlicers)
   mOverlayColor = 130;
 
   mFusionOpacity = 70;
+  mFusionThresOpacity = 1;
   mFusionColorMap = 3;
   mFusionWindow = 1000;
   mFusionLevel = 1000;
@@ -292,6 +293,7 @@ bool vvSlicerManager::SetFusion(std::string filename,int dim, std::string compon
   double *fusRange = mFusionReader->GetOutput()->GetVTKImages()[0]->GetScalarRange();
   mFusionLevel = (fusRange[0]+fusRange[1])/2;
   mFusionWindow = fusRange[1]-fusRange[0];
+
   return true;
 }
 //----------------------------------------------------------------------------
@@ -431,7 +433,6 @@ void vvSlicerManager::SetTSlice(int slice)
   for ( unsigned int i = 0; i < mSlicers.size(); i++) {
     if (slice != mSlicers[i]->GetTSlice()) {
       mSlicers[i]->SetTSlice(slice);
-      if (mSlicers[i]->GetImageActor()->GetVisibility())
         UpdateTSlice(i);
     }
   }
@@ -493,8 +494,7 @@ void vvSlicerManager::SetTSliceInSlicer(int tslice, int slicer)
   if (mSlicers[slicer]->GetTSlice() == tslice) return;
 
   mSlicers[slicer]->SetTSlice(tslice);
-  if (mSlicers[slicer]->GetImageActor()->GetVisibility())
-    UpdateTSlice(slicer);
+  UpdateTSlice(slicer);
 }
 //----------------------------------------------------------------------------
 
@@ -574,7 +574,8 @@ void vvSlicerManager::UpdateViews(int current,int slicer)
     mSlicers[slicer]->Render();
 
     for ( unsigned int i = 0; i < mSlicers.size(); i++) {
-      if (i != (unsigned int)slicer && mSlicers[i]->GetImageActor()->GetVisibility()
+      if (i != (unsigned int)slicer
+          && mSlicers[i]->GetRenderer()->GetDraw()
           && mSlicers[i]->GetRenderWindow()->GetSize()[0] > 2
           && mSlicers[i]->GetRenderWindow()->GetSize()[1] > 2) {
         mSlicers[i]->SetCurrentPosition(mSlicers[slicer]->GetCurrentPosition()[0],
@@ -863,7 +864,7 @@ void vvSlicerManager::UpdateInfoOnCursorPosition(int slicer)
       Z <= mSlicers[slicer]->GetInput()->GetWholeExtent()[5]) {
     value = this->GetScalarComponentAsDouble(mSlicers[slicer]->GetInput(), X, Y, Z);
 
-    if (mSlicers[slicer]->GetVFActor() && mSlicers[slicer]->GetVFActor()->GetVisibility()) {
+    if (mSlicers[slicer]->GetVFActor() ) {
       displayVec = 1;
       unsigned int currentTime = mSlicers[slicer]->GetTSlice();
       vtkImageData *vf = NULL;
@@ -883,7 +884,7 @@ void vvSlicerManager::UpdateInfoOnCursorPosition(int slicer)
         valueVec = sqrt(xVec*xVec + yVec*yVec + zVec*zVec);
       }
     }
-    if (mSlicers[slicer]->GetOverlayActor() && mSlicers[slicer]->GetOverlayActor()->GetVisibility()) {
+    if (mSlicers[slicer]->GetOverlayActor() ) {
       displayOver = 1;
       vtkImageData *overlay = dynamic_cast<vtkImageData*>(mSlicers[slicer]->GetOverlayMapper()->GetInput());
       double Xover = (x - overlay->GetOrigin()[0]) / overlay->GetSpacing()[0];
@@ -891,7 +892,7 @@ void vvSlicerManager::UpdateInfoOnCursorPosition(int slicer)
       double Zover = (z - overlay->GetOrigin()[2]) / overlay->GetSpacing()[2];
       valueOver = this->GetScalarComponentAsDouble(overlay, Xover, Yover, Zover);
     }
-    if (mSlicers[slicer]->GetFusionActor() && mSlicers[slicer]->GetFusionActor()->GetVisibility()) {
+    if (mSlicers[slicer]->GetFusionActor() ) {
       displayFus = 1;
       vtkImageData *fusion = dynamic_cast<vtkImageData*>(mSlicers[slicer]->GetFusionMapper()->GetInput());
       double Xover = (x - fusion->GetOrigin()[0]) / fusion->GetSpacing()[0];
@@ -904,12 +905,6 @@ void vvSlicerManager::UpdateInfoOnCursorPosition(int slicer)
     emit UpdateVector(displayVec,xVec, yVec, zVec, valueVec);
     emit UpdateOverlay(displayOver,valueOver,value);
     emit UpdateFusion(displayFus,valueFus);
-    for (unsigned int i = 0; i < mSlicers.size(); i++) {
-      if (mSlicers[i]->GetImageActor()->GetVisibility() == 1)
-        emit UpdateWindows(i,mSlicers[i]->GetSliceOrientation(),mSlicers[i]->GetSlice());
-      else
-        emit UpdateWindows(i,-1,-1);
-    }
   }
 }
 //----------------------------------------------------------------------------
@@ -1049,14 +1044,6 @@ void vvSlicerManager::SetLocalColorWindowing(const int slicer)
 //----------------------------------------------------------------------------
 
 
-//----------------------------------------------------------------------------
-void vvSlicerManager::SetColorMap()
-{
-  SetColorMap(mColorMap);
-}
-//----------------------------------------------------------------------------
-
-
 //----------------------------------------------------------------------------
 void vvSlicerManager::SetColorMap(int colormap)
 {
@@ -1108,27 +1095,51 @@ void vvSlicerManager::SetColorMap(int colormap)
     LUT->SetTableRange(level-fabs(window)/4,level+fabs(window)/4);
     LUT->Build();
   }
-  vtkLookupTable* fusLUT = NULL;
-  if (mSlicers[0]->GetFusion()) {
-    fusLUT = vtkLookupTable::New();
+  vtkWindowLevelLookupTable* fusLUT = NULL;
+  if (mSlicers[0]->GetFusion()) { // && mFusionColorMap != 0) {
+    fusLUT = vtkWindowLevelLookupTable::New();
     double fusRange [2];
     fusRange[0] = mFusionLevel - mFusionWindow/2;
     fusRange[1] = mFusionLevel + mFusionWindow/2;
-    fusLUT->SetTableRange(fusRange[0],fusRange[1]);
+    double* frange = mFusionReader->GetOutput()->GetVTKImages()[0]->GetScalarRange();
+    fusLUT->SetTableRange(frange);
     fusLUT->SetValueRange(1,1);
     fusLUT->SetSaturationRange(1,1);
+    fusLUT->SetAlphaRange(1, 1);
+    fusLUT->SetWindow(mFusionWindow);
+    fusLUT->SetLevel(mFusionLevel);
     if (mFusionColorMap == 1)
       fusLUT->SetHueRange(0,0.18);
     else if (mFusionColorMap == 2)
       fusLUT->SetHueRange(0.4,0.80);
     else if (mFusionColorMap == 3)
+    {
+      fusLUT->SetHueRange(0.666, 0);
+      fusLUT->SetValueRange(0.5, 1);
+    }
+    else if (mFusionColorMap == 4)
       fusLUT->SetHueRange(0,1);
-    fusLUT->Build();
-    if (mFusionColorMap == 0)
-      fusLUT = NULL;
+    else if (mFusionColorMap == 0)
+    {
+      fusLUT->SetValueRange(0,1);
+      fusLUT->SetSaturationRange(0,0);
+    }
+    
+    fusLUT->ForceBuild();
+    
+    // set color table transparancy
+    double alpha_range_end = frange[0] + (double)mFusionThresOpacity*(frange[1] - frange[0])/100;
+    for (double i = frange[0]; i < alpha_range_end; i++) {
+      double v[4];
+      vtkIdType index = fusLUT->GetIndex(i);
+      fusLUT->GetTableValue(index, v);
+      v[3] = 0;
+      fusLUT->SetTableValue(index, v);
+    }
   }
   for ( unsigned int i = 0; i < mSlicers.size(); i++) {
-    if (mSlicers[i]->GetOverlay() && mSlicers[i]->GetOverlayActor()->GetVisibility()) {
+    
+    if (mSlicers[i]->GetOverlay()) {
       vtkLookupTable* supLUT = vtkLookupTable::New();
       supLUT->SetTableRange(range[0],range[1]);
       supLUT->SetValueRange(1,1);
@@ -1154,11 +1165,10 @@ void vvSlicerManager::SetColorMap(int colormap)
     } else {
       mSlicers[i]->GetWindowLevel()->SetLookupTable(LUT);
     }
-    if (mSlicers[i]->GetFusion() && mSlicers[i]->GetFusionActor()->GetVisibility()) {
+    
+    if (mSlicers[i]->GetFusion()) {
       mSlicers[i]->GetFusionActor()->SetOpacity(double(mFusionOpacity)/100);
       mSlicers[i]->GetFusionMapper()->SetLookupTable(fusLUT);
-      mSlicers[i]->GetFusionMapper()->SetWindow(mFusionWindow);
-      mSlicers[i]->GetFusionMapper()->SetLevel(mFusionLevel);
     }
   }
   if (fusLUT)
index 680a59b0769ab2c1b095afb69577eded13cca3f0..a148d196e6ebdeeb175c4d7407b2276e3c77a2ff 100644 (file)
@@ -113,7 +113,6 @@ class vvSlicerManager : public QObject {
   void SetColorLevel(double s);
   void SetLocalColorWindowing(const int slicer);
   void SetOpacity(int i, double factor);
-  void SetColorMap();
   void SetColorMap(int colormap);
   void SetPreset(int preset);
   void SetOverlayColor(int color) {
@@ -122,6 +121,9 @@ class vvSlicerManager : public QObject {
   void SetFusionOpacity(int opacity) {
     mFusionOpacity = opacity;
   }
+  void SetFusionThresholdOpacity(int thresOpacity) {
+    mFusionThresOpacity = thresOpacity;
+  }
   void SetFusionColorMap(int colorMap) {
     mFusionColorMap = colorMap;
   }
@@ -147,6 +149,9 @@ class vvSlicerManager : public QObject {
   int GetFusionOpacity() {
     return mFusionOpacity;
   }
+  int GetFusionThresholdOpacity() {
+    return mFusionThresOpacity;
+  }
   int GetFusionColorMap() {
     return mFusionColorMap;
   }
@@ -231,6 +236,7 @@ protected:
   int mOverlayColor;
 
   int mFusionOpacity;
+  int mFusionThresOpacity;
   int mFusionColorMap;
   double mFusionWindow;
   double mFusionLevel;
index ab0e5f8b8835b0440a2fe170472d796cb9b9cc11..09a95456a2a1fc574933b63ca3349fb3c81615ff 100644 (file)
@@ -217,6 +217,12 @@ void vvSlicerManagerCommand::Execute(vtkObject *caller,
           this->SM->UpdateLinked(VisibleInWindow);
           return;
         }
+        if (KeyPress == "o") {
+          this->SM->GetSlicer(VisibleInWindow)->SetCurrentPosition(0,0,0,0);
+          this->SM->UpdateViews(1,VisibleInWindow);
+          this->SM->UpdateLinked(VisibleInWindow);
+          return;
+        }
         if (KeyPress == "F5") {
           this->SM->GetSlicer(VisibleInWindow)->FlipHorizontalView();
           this->SM->GetSlicer(VisibleInWindow)->Render();
index 2744dd30e7ded2496082acd0f65e69ab6e602211..50a448941e8f524c0e567191f9356fa51264ff6b 100644 (file)
@@ -22,7 +22,7 @@
 #include <QMenu>
 
 //------------------------------------------------------------------------------
-vvToolCreatorBase::vvToolCreatorBase(QString name): mExperimental(false), mAction(NULL)
+vvToolCreatorBase::vvToolCreatorBase(QString name): mAction(NULL), mExperimental(false)
 {
   mUseContextMenu = false;
   mToolName = name;