------------------------------------------------------------------------------
| 1485 | |
| 1486 | //------------------------------------------------------------------------------ |
| 1487 | void vtkImagePlaneWidget::SetInputConnection(vtkAlgorithmOutput* aout) |
| 1488 | { |
| 1489 | this->Superclass::SetInputConnection(aout); |
| 1490 | |
| 1491 | this->ImageData = |
| 1492 | vtkImageData::SafeDownCast(aout->GetProducer()->GetOutputDataObject(aout->GetIndex())); |
| 1493 | |
| 1494 | if (!this->ImageData) |
| 1495 | { |
| 1496 | // If nullptr is passed, remove any reference that Reslice had |
| 1497 | // on the old ImageData |
| 1498 | // |
| 1499 | this->Reslice->SetInputData(nullptr); |
| 1500 | return; |
| 1501 | } |
| 1502 | |
| 1503 | double range[2]; |
| 1504 | this->ImageData->GetScalarRange(range); |
| 1505 | |
| 1506 | if (!this->UserControlledLookupTable) |
| 1507 | { |
| 1508 | this->LookupTable->SetTableRange(range[0], range[1]); |
| 1509 | this->LookupTable->Build(); |
| 1510 | } |
| 1511 | |
| 1512 | this->OriginalWindow = range[1] - range[0]; |
| 1513 | this->OriginalLevel = 0.5 * (range[0] + range[1]); |
| 1514 | |
| 1515 | if (fabs(this->OriginalWindow) < 0.001) |
| 1516 | { |
| 1517 | this->OriginalWindow = 0.001 * (this->OriginalWindow < 0.0 ? -1 : 1); |
| 1518 | } |
| 1519 | if (fabs(this->OriginalLevel) < 0.001) |
| 1520 | { |
| 1521 | this->OriginalLevel = 0.001 * (this->OriginalLevel < 0.0 ? -1 : 1); |
| 1522 | } |
| 1523 | |
| 1524 | this->SetWindowLevel(this->OriginalWindow, this->OriginalLevel); |
| 1525 | |
| 1526 | this->Reslice->SetInputConnection(aout); |
| 1527 | int interpolate = this->ResliceInterpolate; |
| 1528 | this->ResliceInterpolate = -1; // Force change |
| 1529 | this->SetResliceInterpolate(interpolate); |
| 1530 | |
| 1531 | this->ColorMap->SetInputConnection(this->Reslice->GetOutputPort()); |
| 1532 | |
| 1533 | this->Texture->SetInputConnection(this->ColorMap->GetOutputPort()); |
| 1534 | this->Texture->SetInterpolate(this->TextureInterpolate); |
| 1535 | |
| 1536 | this->SetPlaneOrientation(this->PlaneOrientation); |
| 1537 | } |
| 1538 | |
| 1539 | //------------------------------------------------------------------------------ |
| 1540 | void vtkImagePlaneWidget::UpdatePlane() |
no test coverage detected