void IProbe.Probe(PointF coordinate, CoordinateSystem coordinateSystem) { if (Context.Viewer.SelectedTile == null) { throw new InvalidOperationException("No tile selected."); } if (SelectedPresentationImage == null) { throw new InvalidOperationException("No image selected."); } if (SelectedSpatialTransformProvider == null) { throw new InvalidOperationException("Unsupported image type selected."); } if (coordinateSystem == CoordinateSystem.Destination) { coordinate = SelectedSpatialTransformProvider.SpatialTransform.ConvertToSource(coordinate); } _selectedTile = (Tile)Context.Viewer.SelectedTile; _selectedTile.InformationBox = new InformationBox(); _selectedImageGraphic = SelectedImageGraphicProvider != null ? SelectedImageGraphicProvider.ImageGraphic : null; _selectedSpatialTransform = SelectedSpatialTransformProvider.SpatialTransform; _selectedFrame = ((IImageSopProvider)SelectedPresentationImage).Frame; _selectedCoordinateMapping = SelectedPresentationImage is IPatientCoordinateMappingProvider ? ((IPatientCoordinateMappingProvider)SelectedPresentationImage).PatientCoordinateMapping : null; Probe(Point.Truncate(coordinate), true, true); }
public override void Cancel() { if (_selectedTile == null || _selectedSpatialTransform == null) { return; } _selectedImageGraphic = null; _selectedSpatialTransform = null; _selectedFrame = null; _selectedCoordinateMapping = null; _selectedTile.InformationBox.Visible = false; _selectedTile.InformationBox = null; _selectedTile = null; }
public override bool Start(IMouseInformation mouseInformation) { if (SelectedSpatialTransformProvider == null || SelectedImageSopProvider == null) { return(false); } _selectedTile = mouseInformation.Tile as Tile; if (_selectedTile == null) { return(false); // if it's not Tile, then we can't do anything } _selectedTile.InformationBox = new InformationBox(); _selectedImageGraphic = SelectedImageGraphicProvider != null ? SelectedImageGraphicProvider.ImageGraphic : null; _selectedFrame = ((IImageSopProvider)SelectedPresentationImage).Frame; _selectedCoordinateMapping = SelectedPresentationImage is IPatientCoordinateMappingProvider ? ((IPatientCoordinateMappingProvider)SelectedPresentationImage).PatientCoordinateMapping : null; _selectedSpatialTransform = SelectedSpatialTransformProvider.SpatialTransform; Probe(mouseInformation.Location); return(true); }