# fatilhan/medical-viewer architecture

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

- Interactive diagram: https://gitdiagram.com/fatilhan/medical-viewer
- Repository: https://github.com/fatilhan/medical-viewer

## Overview

##### Project type and purpose
- This is a desktop WPF application (“Medical Viewer”) that visualizes medical DICOM series in three orthogonal slice planes (axial, sagittal, coronal) and in 3D volume‐rendered form.
- It is built on .NET/WPF with an MVVM architecture, using the VTK library (through the Activiz.NET wrapper) for rendering.

##### File structure
- Top‐level solution: OptomoMvvm.sln
- App entry: OptomoMvvm/App.xaml(.cs)
- MVVM folders:
- Views (ControlView, ImagingView)
- ViewModel (ViewModelBase, VtkViewModel)
- Model (VtkModel)
- Core interfaces under Interface/ (IActor2D, IDicomReader, IVolumeMapper, etc.)
- Implementations under Implementation/ (DicomReader, VolumeMapper, Renderer, Lines2D/3D, VolumeProperty, etc.)
- Command pattern implemented via RelayCommand
- Classes (AxialGroup, SagittalGroup, FrontalGroup, View3DGroup) encapsulate per‐view pipelines

##### README for additional insights
- Confirms MVVM pattern and WPF front‐end
- Describes two windows: “ImagingView” (slices + 3D) and “ControlView” (WW/WL, zoom, slice navigation)
- Notes VTK via Activiz.NET, and DICOM file input

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% UI Layer
    subgraph "UI Layer"
        CV["ControlView"]:::ui
        IV["ImagingView"]:::ui
    end

    %% Presentation Layer
    subgraph "Presentation Layer"
        VMB["ViewModelBase"]:::vm
        VTVM["VtkViewModel"]:::vm
        RC["RelayCommand"]:::vm
    end

    %% Domain/Service Layer
    subgraph "Domain/Service Layer"
        VMODEL["VtkModel"]:::domain
        AG["AxialGroup"]:::domain
        SG["SagittalGroup"]:::domain
        FG["FrontalGroup"]:::domain
        V3G["View3DGroup"]:::domain
    end

    %% Implementation Layer
    subgraph "Implementation Layer"
        subgraph "Core Interfaces"
            IActor2D["IActor2D"]:::impl
            IAspectText["IAspectText"]:::impl
            IDicomReader["IDicomReader"]:::impl
            IImageMapper["IImageMapper"]:::impl
            IImageReslice["IImageReslice"]:::impl
            ILines2D["ILines2D"]:::impl
            ILines3D["ILines3D"]:::impl
            IRenderer["IRenderer"]:::impl
            IVolume["IVolume"]:::impl
            IVolumeColor["IVolumeColor"]:::impl
            IVolumeMapper["IVolumeMapper"]:::impl
            IVolumeOpacity["IVolumeOpacity"]:::impl
            IVolumeProperty["IVolumeProperty"]:::impl
        end
        subgraph "VTK Implementations"
            DR["DicomReader"]:::impl
            IRSL["ImageReslice"]:::impl
            IMAP["ImageMapper"]:::impl
            VOL["Volume"]:::impl
            VMAP["VolumeMapper"]:::impl
            VC["VolumeColor"]:::impl
            VO["VolumeOpacity"]:::impl
            VP["VolumeProperty"]:::impl
            REN["Renderer"]:::impl
            A2D["Actor2D"]:::impl
            L2D["Lines2D"]:::impl
            L3D["Lines3D"]:::impl
            ATXT["AspectText"]:::impl
        end
    end

    %% External Resources
    DICOM["DICOM Folder"]:::data
    VTK["VTK Library"]:::external

    %% Connections UI → ViewModel
    CV -->|"Bindings\/Commands"| VTVM
    IV -->|"Bindings\/Commands"| VTVM

    %% Inheritance
    VTVM -->|"Inherits"| VMB

    %% Commands
    VTVM -->|"Executes"| RC

    %% ViewModel → Domain
    VTVM -->|"Configures pipeline"| VMODEL
    VMODEL -->|"Holds group refs"| AG
    VMODEL -->|"Holds group refs"| SG
    VMODEL -->|"Holds group refs"| FG
    VMODEL -->|"Holds group refs"| V3G

    %% Domain → Interfaces
    AG -->|"Uses"| IImageReslice
    SG -->|"Uses"| IImageReslice
    FG -->|"Uses"| IImageReslice
    V3G -->|"Uses"| IDicomReader

    %% Interface → Implementation
    IDicomReader -->|"Reads DICOM"| DR
    IImageReslice -->|"Reslices image"| IRSL
    IImageMapper -->|"Maps image"| IMAP
    IVolumeMapper -->|"Maps volume"| VMAP
    IRenderer -->|"Renders actor"| REN
    IVolumeProperty -->|"Sets volume props"| VP
    ILines2D -->|"Draws lines"| L2D
    ILines3D -->|"Draws lines"| L3D
    IActor2D -->|"Creates actor"| A2D
    IAspectText -->|"Creates text"| ATXT

    %% Implementation → External
    DR -->|"Reads DICOM"| DICOM
    IRSL -->|"Processes image"| VTK
    IMAP -->|"Processes image"| VTK
    VOL -->|"Creates volume"| VTK
    VMAP -->|"Processes volume"| VTK
    VC -->|"Colors volume"| VTK
    VO -->|"Sets opacity"| VTK
    VP -->|"Configures volume"| VTK
    REN -->|"Triggers render"| VTK
    A2D -->|"Renders actor"| VTK
    L2D -->|"Renders lines"| VTK
    L3D -->|"Renders lines"| VTK
    ATXT -->|"Renders text"| VTK

    %% External Data Source
    DICOM -->|"File system"| DR

    %% Click Events
    click CV "https://github.com/fatilhan/medical-viewer/blob/master/OptomoMvvm/Views/ControlView.xaml"
    click IV "https://github.com/fatilhan/medical-viewer/blob/master/OptomoMvvm/Views/ImagingView.xaml"
    click VMB "https://github.com/fatilhan/medical-viewer/blob/master/OptomoMvvm/ViewModel/ViewModelBase.cs"
    click VTVM "https://github.com/fatilhan/medical-viewer/blob/master/OptomoMvvm/ViewModel/VtkViewModel.cs"
    click RC "https://github.com/fatilhan/medical-viewer/blob/master/OptomoMvvm/Command/RelayCommand.cs"
    click VMODEL "https://github.com/fatilhan/medical-viewer/blob/master/OptomoMvvm/Model/VtkModel.cs"
    click AG "https://github.com/fatilhan/medical-viewer/blob/master/OptomoMvvm/Group/AxialGroup.cs"
    click SG "https://github.com/fatilhan/medical-viewer/blob/master/OptomoMvvm/Group/SagittalGroup.cs"
    click FG "https://github.com/fatilhan/medical-viewer/blob/master/OptomoMvvm/Group/FrontalGroup.cs"
    click V3G "https://github.com/fatilhan/medical-viewer/blob/master/OptomoMvvm/Group/View3DGroup.cs"
    click IActor2D "https://github.com/fatilhan/medical-viewer/blob/master/OptomoMvvm/Interface/IActor2D.cs"
    click IAspectText "https://github.com/fatilhan/medical-viewer/blob/master/OptomoMvvm/Interface/IAspectText.cs"
    click IDicomReader "https://github.com/fatilhan/medical-viewer/blob/master/OptomoMvvm/Interface/IDicomReader.cs"
    click IImageMapper "https://github.com/fatilhan/medical-viewer/blob/master/OptomoMvvm/Interface/IImageMapper.cs"
    click IImageReslice "https://github.com/fatilhan/medical-viewer/blob/master/OptomoMvvm/Interface/IImageReslice.cs"
    click ILines2D "https://github.com/fatilhan/medical-viewer/blob/master/OptomoMvvm/Interface/ILines2D.cs"
    click ILines3D "https://github.com/fatilhan/medical-viewer/blob/master/OptomoMvvm/Interface/ILines3D.cs"
    click IRenderer "https://github.com/fatilhan/medical-viewer/blob/master/OptomoMvvm/Interface/IRenderer.cs"
    click IVolume "https://github.com/fatilhan/medical-viewer/blob/master/OptomoMvvm/Interface/IVolume.cs"
    click IVolumeColor "https://github.com/fatilhan/medical-viewer/blob/master/OptomoMvvm/Interface/IVolumeColor.cs"
    click IVolumeMapper "https://github.com/fatilhan/medical-viewer/blob/master/OptomoMvvm/Interface/IVolumeMapper.cs"
    click IVolumeOpacity "https://github.com/fatilhan/medical-viewer/blob/master/OptomoMvvm/Interface/IVolumeOpacity.cs"
    click IVolumeProperty "https://github.com/fatilhan/medical-viewer/blob/master/OptomoMvvm/Interface/IVolumeProperty.cs"
    click DR "https://github.com/fatilhan/medical-viewer/blob/master/OptomoMvvm/Implementation/DicomReader.cs"
    click IRSL "https://github.com/fatilhan/medical-viewer/blob/master/OptomoMvvm/Implementation/ImageReslice.cs"
    click IMAP "https://github.com/fatilhan/medical-viewer/blob/master/OptomoMvvm/Implementation/ImageMapper.cs"
    click VOL "https://github.com/fatilhan/medical-viewer/blob/master/OptomoMvvm/Implementation/Volume.cs"
    click VMAP "https://github.com/fatilhan/medical-viewer/blob/master/OptomoMvvm/Implementation/VolumeMapper.cs"
    click VC "https://github.com/fatilhan/medical-viewer/blob/master/OptomoMvvm/Implementation/VolumeColor.cs"
    click VO "https://github.com/fatilhan/medical-viewer/blob/master/OptomoMvvm/Implementation/VolumeOpacity.cs"
    click VP "https://github.com/fatilhan/medical-viewer/blob/master/OptomoMvvm/Implementation/VolumeProperty.cs"
    click REN "https://github.com/fatilhan/medical-viewer/blob/master/OptomoMvvm/Implementation/Renderer.cs"
    click A2D "https://github.com/fatilhan/medical-viewer/blob/master/OptomoMvvm/Implementation/Actor2D.cs"
    click L2D "https://github.com/fatilhan/medical-viewer/blob/master/OptomoMvvm/Implementation/Lines2D.cs"
    click L3D "https://github.com/fatilhan/medical-viewer/blob/master/OptomoMvvm/Implementation/Lines3D.cs"
    click ATXT "https://github.com/fatilhan/medical-viewer/blob/master/OptomoMvvm/Implementation/AspectText.cs"

    %% Styles
    classDef ui fill:#bbdefb,stroke:#2196f3;
    classDef vm fill:#c8e6c9,stroke:#4caf50;
    classDef domain fill:#ffe0b2,stroke:#ff9800;
    classDef impl fill:#fff9c4,stroke:#fbc02d;
    classDef external fill:#ffcdd2,stroke:#e91e63;
    classDef data fill:#e0e0e0,stroke:#9e9e9e;
```
