double range[2];
mSlicerManagers.back()->GetImage()->GetFirstVTKImageData()->GetScalarRange(range);
if ((range[0] == 0) && (range[1] == 1)) {
- presetComboBox->setCurrentIndex(5);// binary
+ presetComboBox->setCurrentIndex(WL_BINARY);// binary
} else {
// TODO
}
//------------------------------------------------------------------------------
void vvMainWindow::WindowLevelEdited()
{
- presetComboBox->setCurrentIndex(6);
+ presetComboBox->setCurrentIndex(WL_USER);
UpdateWindowLevel();
}
//------------------------------------------------------------------------------
{
windowSpinBox->setValue(w);
levelSpinBox->setValue(l);
- presetComboBox->setCurrentIndex(6);
+ presetComboBox->setCurrentIndex(WL_USER);
colorMapComboBox->setCurrentIndex(0);
UpdateWindowLevel();
}
void vvMainWindow::UpdateWindowLevel()
{
if (DataTree->selectedItems().size()) {
- if (presetComboBox->currentIndex() == 7) //For ventilation
+ if (presetComboBox->currentIndex() == WL_VENTILATION) //For ventilation
colorMapComboBox->setCurrentIndex(5);
int index = GetSlicerIndexFromItem(DataTree->selectedItems()[0]);
mSlicerManagers[index]->SetColorWindow(windowSpinBox->value());
{
int index = GetSlicerIndexFromItem(DataTree->selectedItems()[0]);
int window = mSlicerManagers[index]->GetColorWindow();
- presetComboBox->setCurrentIndex(6);
+ presetComboBox->setCurrentIndex(WL_USER);
windowSpinBox->setValue(-window);
UpdateWindowLevel();
}
continue;
mSlicerManagers[i]->SetColorWindow(window);
mSlicerManagers[i]->SetColorLevel(level);
- mSlicerManagers[i]->SetPreset(6);
+ mSlicerManagers[i]->SetPreset(WL_USER);
mSlicerManagers[i]->Render();
}
}
if (mSlicerManagers[i] == NULL)
continue;
mSlicerManagers[i]->SetColorWindow(window);
- mSlicerManagers[i]->SetPreset(6);
+ mSlicerManagers[i]->SetPreset(WL_USER);
mSlicerManagers[i]->Render();
}
}
if (mSlicerManagers[i] == NULL)
continue;
mSlicerManagers[i]->SetColorLevel(level);
- mSlicerManagers[i]->SetPreset(6);
+ mSlicerManagers[i]->SetPreset(WL_USER);
mSlicerManagers[i]->Render();
}
}
//----------------------------------------------------------------------------\r
void vvSlicerManager::SetPreset(int preset)\r
{\r
+\r
//vtkLookupTable* LUT = static_cast<vtkLookupTable*>(mSlicers[0]->GetWindowLevel()->GetLookupTable());\r
double window = mSlicers[0]->GetColorWindow();\r
double level = mSlicers[0]->GetColorLevel();\r
\r
std::string component_type=mImage->GetScalarTypeAsITKString();\r
switch (preset) {\r
- case 0:\r
+ case WL_AUTO:\r
double range[2];\r
mImage->GetScalarRange(range);\r
window = range[1] - range[0];\r
level = (range[1] + range[0])* 0.5;\r
break;\r
- case 1:\r
+ case WL_HOUNSFIELD:\r
window = 2000;\r
level = 0;\r
break;\r
- case 2:\r
+ case WL_SOFTTISSUE:\r
window = 400;\r
level = 20;\r
break;\r
- case 3: // lungs (same as FOCAL)\r
+ case WL_LUNGS: // lungs (same as FOCAL)\r
window = 1700;\r
level = -300;\r
break;\r
- case 4:\r
+ case WL_BONES:\r
window = 1000;\r
level = 500;\r
break;\r
- case 5:\r
+ case WL_HEAD:\r
window = 200;\r
level = 70;\r
break;\r
- case 6:\r
+ case WL_BINARY:\r
window = 1;\r
level = 0.5;\r
break;\r
- case 7:\r
+ case WL_USER:\r
break;\r
- case 8:\r
+ case WL_VENTILATION:\r
window=1.;\r
level=0.;\r
break;\r
this->mSlicers[slicer]->GetConcatenatedTransform());\r
this->SetColorWindow(max-min);\r
this->SetColorLevel(0.5*(min+max));\r
- this->SetPreset(6);\r
+ this->SetPreset(WL_USER);\r
}\r
this->Render();\r
this->UpdateWindowLevel();\r
class vvImageReader;
class vvLandmarks;
+enum WindowLevelPreset {
+ WL_AUTO,
+ WL_HOUNSFIELD,
+ WL_SOFTTISSUE,
+ WL_LUNGS,
+ WL_BONES,
+ WL_HEAD,
+ WL_BINARY,
+ WL_USER,
+ WL_VENTILATION
+};
+
//------------------------------------------------------------------------------
class vvSlicerManager : public QObject {
Q_OBJECT
return;
}
if (KeyPress == "0") {
- this->SM->SetPreset(0);
+ this->SM->SetPreset(WL_AUTO);
this->SM->UpdateWindowLevel();
return;
}
if (KeyPress == "1") {
- this->SM->SetPreset(1);
+ this->SM->SetPreset(WL_HOUNSFIELD);
this->SM->UpdateWindowLevel();
return;
}
if (KeyPress == "2") {
- this->SM->SetPreset(2);
+ this->SM->SetPreset(WL_SOFTTISSUE);
this->SM->UpdateWindowLevel();
return;
}
if (KeyPress == "3") {
- this->SM->SetPreset(3);
+ this->SM->SetPreset(WL_LUNGS);
this->SM->UpdateWindowLevel();
return;
}
if (KeyPress == "4") {
- this->SM->SetPreset(4);
+ this->SM->SetPreset(WL_BONES);
this->SM->UpdateWindowLevel();
return;
}
if (KeyPress == "5") {
- this->SM->SetPreset(5);
+ this->SM->SetPreset(WL_HEAD);
this->SM->UpdateWindowLevel();
return;
}
return;
}
if (KeyPress == "equal") { //keycodes are in vtkWin32RenderWindowInteractor
- this->SM->SetPreset(7);
+ this->SM->SetPreset(WL_VENTILATION);
//this->SM->SetColorMap(1);
this->SM->UpdateWindowLevel();
return;
this->SM->SetColorWindow(window*dx);
this->SM->SetColorLevel(level-dy);
- this->SM->SetPreset(6);
+ this->SM->SetPreset(WL_USER);
this->SM->Render();
this->SM->UpdateWindowLevel();
return;