# jeremyhuiskamp/dcm architecture

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

- Interactive diagram: https://gitdiagram.com/jeremyhuiskamp/dcm
- Repository: https://github.com/jeremyhuiskamp/dcm

## Overview

##### Main Components

a. Core DICOM Components (dcm package):
- Data Dictionary Handler
- Object Management
- Tag Processing
- Transfer Syntax Handler
- Value Representation (VR) Processing

b. I/O Operations Layer (dcmio package):
- Parser Component
- Builder Component
- Test Data Handling

c. Network Operations Layer (dcmnet package):
- Association Management
- PDU (Protocol Data Unit) Processing
- Command Processing
- Stream Processing
- Message Handling

d. Command Line Tools:
- cecho (DICOM echo utility)
- dcm2txt (DICOM to text converter)

- [Command Line Tools Layer]
- ↓
- [Network Operations Layer]
- ↓
- [I/O Operations Layer]
- ↓
- [Core DICOM Layer]
- ↓
- [Stream Handling Layer]

##### Specific Implementation Details to Highlight

a. Core DICOM Layer:
- Relationship between tag processing (tag.go) and data dictionary (datadict.go)
- Object model handling (obj.go)
- Transfer syntax processing (ts.go)

b. Network Layer:
- PDU processing flow
- Association handling
- Command processing pipeline

c. I/O Layer:
- Parsing and building operations
- Test data flow

##### Additional Elements

Technical details in supplementary notes:
- Supported DICOM operations
- Data flow directions
- Test coverage paths
- Generated code components (like tags_generator.go)

##### Implementation Notes

- The modular nature of the implementation
- Clear separation between network, I/O, and core DICOM functionality
- Test coverage and validation paths
- Command-line tool integration points

## Diagram (Mermaid)

```mermaid
graph TB
    %% Define styles
    classDef core fill:#b3d1ff,stroke:#333,stroke-width:1px
    classDef io fill:#90EE90,stroke:#333,stroke-width:1px
    classDef network fill:#FFB366,stroke:#333,stroke-width:1px
    classDef tools fill:#DDA0DD,stroke:#333,stroke-width:1px
    classDef stream fill:#E6E6E6,stroke:#333,stroke-width:1px

    %% Command Line Tools Layer
    subgraph CLI
        CECHO["DICOM Echo Utility"]
        DCM2TXT["DICOM to Text Converter"]
    end

    %% Network Operations Layer
    subgraph Network
        ASSOC["Association Management"]
        PDU["PDU Processing"]
        CMD["Command Processing"]
        STREAM_DEC["Stream Decoder"]
        MSG["Message Handling"]
    end

    %% I/O Operations Layer
    subgraph IO
        PARSER["Parser Component"]
        BUILDER["Builder Component"]
        TEST_DATA["Test Data Handling"]
    end

    %% Core DICOM Layer
    subgraph Core
        DICT["Data Dictionary Handler"]
        OBJ["Object Management"]
        TAG["Tag Processing"]
        TS["Transfer Syntax Handler"]
        VR["Value Representation"]
        TAGGEN["Tag Generator"]
    end

    %% Stream Layer
    subgraph Stream
        STREAM["Stream Handler"]
    end

    %% Relationships
    CECHO --> ASSOC
    DCM2TXT --> PARSER
    
    ASSOC --> PDU
    PDU --> CMD
    CMD --> STREAM_DEC
    STREAM_DEC --> MSG
    MSG --> PARSER
    
    PARSER --> DICT
    PARSER --> OBJ
    BUILDER --> OBJ
    BUILDER --> TS
    
    OBJ --> TAG
    OBJ --> VR
    DICT --> TAG
    TS --> STREAM
    
    TAGGEN --> TAG

    %% Click events for component mapping
    click DICT "https://github.com/jeremyhuiskamp/dcm/blob/master/dcm/datadict.go"
    click OBJ "https://github.com/jeremyhuiskamp/dcm/blob/master/dcm/obj.go"
    click TAG "https://github.com/jeremyhuiskamp/dcm/blob/master/dcm/tag.go"
    click TS "https://github.com/jeremyhuiskamp/dcm/blob/master/dcm/ts.go"
    click VR "https://github.com/jeremyhuiskamp/dcm/blob/master/dcm/vr.go"
    click PARSER "https://github.com/jeremyhuiskamp/dcm/blob/master/dcmio/parse.go"
    click BUILDER "https://github.com/jeremyhuiskamp/dcm/blob/master/dcmio/build.go"
    click TEST_DATA "https://github.com/jeremyhuiskamp/dcm/tree/master/dcmio/testdata/"
    click ASSOC "https://github.com/jeremyhuiskamp/dcm/blob/master/dcmnet/assoc.go"
    click PDU "https://github.com/jeremyhuiskamp/dcm/blob/master/dcmnet/pdu.go"
    click CMD "https://github.com/jeremyhuiskamp/dcm/blob/master/dcmnet/cmd.go"
    click STREAM_DEC "https://github.com/jeremyhuiskamp/dcm/blob/master/dcmnet/stream_decoder.go"
    click MSG "https://github.com/jeremyhuiskamp/dcm/blob/master/dcmnet/message.go"
    click CECHO "https://github.com/jeremyhuiskamp/dcm/blob/master/cmd/cecho/main.go"
    click DCM2TXT "https://github.com/jeremyhuiskamp/dcm/blob/master/cmd/dcm2txt/main.go"
    click STREAM "https://github.com/jeremyhuiskamp/dcm/blob/master/stream/stream.go"
    click TAGGEN "https://github.com/jeremyhuiskamp/dcm/blob/master/dcmtaggen/tags_generator.go"

    %% Style applications
    class DICT,OBJ,TAG,TS,VR,TAGGEN core
    class PARSER,BUILDER,TEST_DATA io
    class ASSOC,PDU,CMD,STREAM_DEC,MSG network
    class CECHO,DCM2TXT tools
    class STREAM stream
```
