------------------------------------------------------------------------------
| 1226 | |
| 1227 | //------------------------------------------------------------------------------ |
| 1228 | void vtkImagePlaneWidget::SetWindowLevel(double window, double level, int copy) |
| 1229 | { |
| 1230 | if (copy) |
| 1231 | { |
| 1232 | this->CurrentWindow = window; |
| 1233 | this->CurrentLevel = level; |
| 1234 | return; |
| 1235 | } |
| 1236 | |
| 1237 | if (this->CurrentWindow == window && this->CurrentLevel == level) |
| 1238 | { |
| 1239 | return; |
| 1240 | } |
| 1241 | |
| 1242 | // if the new window is negative and the old window was positive invert table |
| 1243 | if (((window < 0 && this->CurrentWindow > 0) || (window > 0 && this->CurrentWindow < 0)) && |
| 1244 | !this->UserControlledLookupTable) |
| 1245 | { |
| 1246 | this->InvertTable(); |
| 1247 | } |
| 1248 | |
| 1249 | this->CurrentWindow = window; |
| 1250 | this->CurrentLevel = level; |
| 1251 | |
| 1252 | if (!this->UserControlledLookupTable) |
| 1253 | { |
| 1254 | double rmin = this->CurrentLevel - 0.5 * fabs(this->CurrentWindow); |
| 1255 | double rmax = rmin + fabs(this->CurrentWindow); |
| 1256 | this->LookupTable->SetTableRange(rmin, rmax); |
| 1257 | } |
| 1258 | |
| 1259 | if (this->Enabled) |
| 1260 | { |
| 1261 | this->Interactor->Render(); |
| 1262 | } |
| 1263 | } |
| 1264 | |
| 1265 | //------------------------------------------------------------------------------ |
| 1266 | void vtkImagePlaneWidget::GetWindowLevel(double wl[2]) |