# Script repository

:::{note}

**Usage**: Copy-paste the code lines displayed below or the linked `.py` file contents into Python console in Slicer. Or save them to a `.py` file and run them using `execfile`.

To run a Python code snippet automatically at each application startup, add it to the [.slicerrc.py file](../user_guide/settings.md#application-startup-file).

:::

:::{note}

**More reference code**:
The Slicer source code has Python [scripted modules](https://github.com/Slicer/Slicer/tree/main/Modules/Scripted) and [scripted Segmentation Editor effects](https://github.com/Slicer/Slicer/tree/main/Modules/Loadable/Segmentations/EditorEffects/Python) that can be used as working examples.
* Most [Slicer Extensions](https://github.com/topics/3d-slicer-extension) are written in Python to address specific use cases.  Looking at their source code can be informative.
* The [Slicer Discourse forum](https://discourse.slicer.org/) has many code snippets and discussions.

:::

```{include} script_repository/gui.md
```

```{include} script_repository/packaging.md
```

```{include} script_repository/dicom.md
```

```{include} script_repository/markups.md
```

```{include} script_repository/models.md
```

```{include} script_repository/plots.md
```

```{include} script_repository/screencapture.md
```

```{include} script_repository/segmentations.md
```

```{include} script_repository/registration.md
```

```{include} script_repository/sequences.md
```

```{include} script_repository/subjecthierarchy.md
```

```{include} script_repository/tractography.md
```

```{include} script_repository/transforms.md
```

```{include} script_repository/volumes.md
```

```{include} script_repository/batch.md
```

```{include} script_repository/webserver.md
```
