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);
}
}
}
mSlicerManagers[slicerManagerIndex]->UpdateInfoOnCursorPosition(column-1);
DisplaySliders(slicerManagerIndex, column-1);
if(clickedParentItem == clickedItem) {
- // Toggle or force visibility if it was not on this branch so far
+ // Toggle
vis = !draw || !vis;
}
clickedSlicer->SetActorVisibility("image", 0, vis);
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
-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);
//------------------------------------------------------------------------------
-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) {
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]) << ' '
//----------------------------------------------------------------------------
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;
}
//----------------------------------------------------------------------------
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;
}
//----------------------------------------------------------------------------
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);
}
}
if (mSlicers[slicer]->GetTSlice() == tslice) return;
mSlicers[slicer]->SetTSlice(tslice);
- if (mSlicers[slicer]->GetImageActor()->GetVisibility())
- UpdateTSlice(slicer);
+ UpdateTSlice(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],
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;
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];
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];
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);
- }
}
}
//----------------------------------------------------------------------------
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)