<rect>
<x>0</x>
<y>0</y>
- <width>323</width>
- <height>447</height>
+ <width>342</width>
+ <height>480</height>
</rect>
</property>
<property name="sizePolicy">
</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>
<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">
</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">
</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">
</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">
</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">
<string>Cold</string>
</property>
</item>
+ <item>
+ <property name="text">
+ <string>Dosimetry</string>
+ </property>
+ </item>
<item>
<property name="text">
<string>Full Color Range</string>
</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>
</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>
</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">
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
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);
}
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
-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);
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();
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()));
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);
fusionFrame->setEnabled(0);
opacityHorizontalSlider->setEnabled(0);
opacityHorizontalSlider->setValue(0);
+ thresOpacityHorizontalSlider->setEnabled(0);
+ thresOpacityHorizontalSlider->setValue(0);
fusionColorMapComboBox->setEnabled(0);
fusionColorMapComboBox->setCurrentIndex(-1);
windowSpinBox->setEnabled(0);
void vvOverlayPanel::setFusionProperty()
{
- emit FusionPropertyUpdated(opacityHorizontalSlider->value(), fusionColorMapComboBox->currentIndex(),
+ emit FusionPropertyUpdated(opacityHorizontalSlider->value(), thresOpacityHorizontalSlider->value(), fusionColorMapComboBox->currentIndex(),
windowSpinBox->value(), levelSpinBox->value());
}
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);
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
//====================================================================
//------------------------------------------------------------------------------
-vtkImageMapToWindowLevelColors* vvSlicer::GetFusionMapper()
+vtkImageMapToColors* vvSlicer::GetFusionMapper()
{
return mFusionMapper.GetPointer();
}
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) {
#include <vtkSmartPointer.h>
#include <vtkImageViewer2.h>
#include <vtkImageReslice.h>
+#include <vtkImageMapToColors.h>
class vtkActor;
class vtkActor2D;
}
vtkImageMapToWindowLevelColors* GetOverlayMapper();
vvBlendImageActor* GetOverlayActor() ;
- vtkImageMapToWindowLevelColors* GetFusionMapper() ;
+ vtkImageMapToColors* GetFusionMapper() ;
vtkImageActor* GetFusionActor() ;
vtkActor* GetVFActor() ;
vtkCornerAnnotation* GetAnnotation();
vtkSmartPointer<vtkImageMapToWindowLevelColors> mOverlayMapper;
vtkSmartPointer<vvBlendImageActor> mOverlayActor;
vtkSmartPointer<vtkImageReslice> mFusionReslice;
- vtkSmartPointer<vtkImageMapToWindowLevelColors> mFusionMapper;
+ vtkSmartPointer<vtkImageMapToColors> mFusionMapper;
vtkSmartPointer<vtkImageActor> mFusionActor;
vtkSmartPointer<vtkCornerAnnotation> ca;
vtkSmartPointer<vtkCursor2D> crossCursor;
mOverlayColor = 130;
mFusionOpacity = 70;
+ mFusionThresOpacity = 1;
mFusionColorMap = 3;
mFusionWindow = 1000;
mFusionLevel = 1000;
double *fusRange = mFusionReader->GetOutput()->GetVTKImages()[0]->GetScalarRange();
mFusionLevel = (fusRange[0]+fusRange[1])/2;
mFusionWindow = fusRange[1]-fusRange[0];
+
return true;
}
//----------------------------------------------------------------------------
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()) {
vtkLookupTable* supLUT = vtkLookupTable::New();
supLUT->SetTableRange(range[0],range[1]);
} else {
mSlicers[i]->GetWindowLevel()->SetLookupTable(LUT);
}
+
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)
void SetFusionOpacity(int opacity) {
mFusionOpacity = opacity;
}
+ void SetFusionThresholdOpacity(int thresOpacity) {
+ mFusionThresOpacity = thresOpacity;
+ }
void SetFusionColorMap(int colorMap) {
mFusionColorMap = colorMap;
}
int GetFusionOpacity() {
return mFusionOpacity;
}
+ int GetFusionThresholdOpacity() {
+ return mFusionThresOpacity;
+ }
int GetFusionColorMap() {
return mFusionColorMap;
}
int mOverlayColor;
int mFusionOpacity;
+ int mFusionThresOpacity;
int mFusionColorMap;
double mFusionWindow;
double mFusionLevel;
#include <QMenu>
//------------------------------------------------------------------------------
-vvToolCreatorBase::vvToolCreatorBase(QString name): mExperimental(false), mAction(NULL)
+vvToolCreatorBase::vvToolCreatorBase(QString name): mAction(NULL), mExperimental(false)
{
mUseContextMenu = false;
mToolName = name;