```{image} ../../src/orangecontrib/ewoks3dxrd/icons/distortion_plane.svg
:alt: Detector Correction Widget Icon
:class: widget-title-icon
```
# Detector Correction Widget

The **Detector Correction** widget provides a graphical interface to:
* correct spatially deformed detector data into a flat plane. 
* visualize the shift between raw and corrected peak positions.


## Functionality

This widget allows you to:
1. **Load Segmented Peaks**: Input a Nexus URL containing your segmented 3D peaks.
2. **Configure Correction**: Specify your spline or e2dx/e2dy files.
3. **Visualize Results**: Compare raw pixels (Blue circles) vs. Corrected pixels (Red crosses)

## User Interface
![Image showing an empty detector correction widget](../_static/tuto/empty_detector_correction.png)


## Control Panel
### Detector Correction Settings
- "Correction with spline file": check if the detector correction should use a spline file (exclusive with "Correction with Dx/Dy file")
- "Correction with Dx/Dy file": check if the detector correction should use dx/dy file (exclusive with "Correction with spline file")

### Execution Control
- "Execute Detector Correction": button to trigger the processing.
- "Overwrite": check to overwrite existing results at the expected location.

### Plot Area (Right)
The widget shows the effect of the correction:
- **Blue circles**: Represent the raw pixel positions from the input data.
- **Red crosses**: Represent the spatially corrected positions after execution.

## Example Usage
1. Connect a widget that outputs a `segmented_peaks_url`.
2. Select your `.spline` file in the parameters box.
3. Click **Execute**. The plot will update to show the overlaid "before and after" coordinates.

![Detector Correction GUI Tool Box](../_static/tuto/detector_correction.png)