# ivrugue/pixelshuffler architecture

> Architecture diagram of the GitHub repository ivrugue/pixelshuffler, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ivrugue/pixelshuffler
- Repository: https://github.com/ivrugue/pixelshuffler

## Overview

PixelShuffler is presented as an image-to-image style-transfer method. The demonstrated runtime accepts content and style images, iteratively deforms the style image toward the content image using selectable losses, then saves the result. The README describes pixel shuffling and mutual-information maximization, but the inspected entry point instead uses a MONAI UNet and image warping; no pixel-shuffle implementation is evidenced in the supplied source. The registration-network and deformation-loss modules are substantial, but their connection to the demonstrated workflow is not shown.

Main entry points: [`style_transfer.py`](https://github.com/ivrugue/pixelshuffler/blob/main/style_transfer.py) (CLI and Optimizer), [`utils.py`](https://github.com/ivrugue/pixelshuffler/blob/main/utils.py) (Feature Style Loss)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Style Transfer"]
  node_runner["CLI and Optimizer<br/>[style_transfer.py]"]
  node_registration_model["Registration UNet<br/>[style_transfer.py]"]
  node_image_warp["Image Warping<br/>[style_transfer.py]"]
  node_mi_loss["Mutual Information<br/>[style_transfer.py]"]
  node_lpips_loss["LPIPS Loss<br/>[style_transfer.py]"]
  node_image_export["Result Export<br/>[style_transfer.py]"]
end

subgraph group_support["Image and Loss Support"]
  node_image_io["Image Loading<br/>[utils.py]"]
  node_deformation["Field Conversion<br/>[utils.py]"]
  node_style_loss["Feature Style Loss<br/>[utils.py]"]
  node_feature_extractor["VGG Features<br/>[utils.py]"]
end

subgraph group_registration["Registration Components"]
  node_registration_arch["Registration Networks<br/>[networks.py]"]
  node_deformation_losses["Deformation Losses<br/>[deform_losses.py]"]
end

node_user(("CLI User"))

node_user -->|"invokes"| node_runner
node_runner -->|"loads images"| node_image_io
node_runner -->|"predicts field"| node_registration_model
node_runner -->|"converts field"| node_deformation
node_runner -->|"warps image"| node_image_warp
node_runner -->|"computes loss"| node_mi_loss
node_runner -->|"computes loss"| node_lpips_loss
node_runner -->|"computes loss"| node_style_loss
node_style_loss -->|"extracts features"| node_feature_extractor
node_runner -->|"saves result"| node_image_export

click node_runner "https://github.com/ivrugue/pixelshuffler/blob/main/style_transfer.py"
click node_image_io "https://github.com/ivrugue/pixelshuffler/blob/main/utils.py"
click node_registration_model "https://github.com/ivrugue/pixelshuffler/blob/main/style_transfer.py"
click node_deformation "https://github.com/ivrugue/pixelshuffler/blob/main/utils.py"
click node_image_warp "https://github.com/ivrugue/pixelshuffler/blob/main/style_transfer.py"
click node_mi_loss "https://github.com/ivrugue/pixelshuffler/blob/main/style_transfer.py"
click node_lpips_loss "https://github.com/ivrugue/pixelshuffler/blob/main/style_transfer.py"
click node_style_loss "https://github.com/ivrugue/pixelshuffler/blob/main/utils.py"
click node_feature_extractor "https://github.com/ivrugue/pixelshuffler/blob/main/utils.py"
click node_image_export "https://github.com/ivrugue/pixelshuffler/blob/main/style_transfer.py"
click node_registration_arch "https://github.com/ivrugue/pixelshuffler/blob/main/networks/networks.py"
click node_deformation_losses "https://github.com/ivrugue/pixelshuffler/blob/main/networks/deform_losses.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_runner,node_registration_model,node_image_warp,node_mi_loss,node_lpips_loss,node_image_export,node_user toneBlue
class node_image_io,node_deformation,node_style_loss,node_feature_extractor toneAmber
class node_registration_arch,node_deformation_losses toneMint
```

## Components

### Style Transfer

- [CLI and Optimizer](https://github.com/ivrugue/pixelshuffler/blob/main/style_transfer.py): `style_transfer.py`
- [Registration UNet](https://github.com/ivrugue/pixelshuffler/blob/main/style_transfer.py): `style_transfer.py`
- [Image Warping](https://github.com/ivrugue/pixelshuffler/blob/main/style_transfer.py): `style_transfer.py`
- [Mutual Information](https://github.com/ivrugue/pixelshuffler/blob/main/style_transfer.py): `style_transfer.py`
- [LPIPS Loss](https://github.com/ivrugue/pixelshuffler/blob/main/style_transfer.py): `style_transfer.py`
- [Result Export](https://github.com/ivrugue/pixelshuffler/blob/main/style_transfer.py): `style_transfer.py`

### Image and Loss Support

- [Image Loading](https://github.com/ivrugue/pixelshuffler/blob/main/utils.py): `utils.py`
- [Field Conversion](https://github.com/ivrugue/pixelshuffler/blob/main/utils.py): `utils.py`
- [Feature Style Loss](https://github.com/ivrugue/pixelshuffler/blob/main/utils.py): `utils.py`
- [VGG Features](https://github.com/ivrugue/pixelshuffler/blob/main/utils.py): `utils.py`

### Registration Components

- [Registration Networks](https://github.com/ivrugue/pixelshuffler/blob/main/networks/networks.py): `networks/networks.py`
- [Deformation Losses](https://github.com/ivrugue/pixelshuffler/blob/main/networks/deform_losses.py): `networks/deform_losses.py`

### Other components

- **CLI User**

## Connections

- CLI User → CLI and Optimizer: invokes (evidence: `README.md`)
- CLI and Optimizer → Image Loading: loads images (evidence: `style_transfer.py`)
- CLI and Optimizer → Registration UNet: predicts field (evidence: `style_transfer.py`)
- CLI and Optimizer → Field Conversion: converts field (evidence: `style_transfer.py`)
- CLI and Optimizer → Image Warping: warps image (evidence: `style_transfer.py`)
- CLI and Optimizer → Mutual Information: computes loss (evidence: `style_transfer.py`)
- CLI and Optimizer → LPIPS Loss: computes loss (evidence: `style_transfer.py`)
- CLI and Optimizer → Feature Style Loss: computes loss (evidence: `style_transfer.py`)
- Feature Style Loss → VGG Features: extracts features (evidence: `utils.py`)
- CLI and Optimizer → Result Export: saves result (evidence: `style_transfer.py`)
