Thank you for your interest in contributing to DICOMKit! This document provides guidelines for contributing to the project.
Be respectful and professional in all interactions. We aim to create a welcoming environment for all contributors.
- Fork the repository
- Clone your fork:
git clone https://github.com/YOUR_USERNAME/DICOMKit.git - Create a feature branch:
git checkout -b feature/your-feature-name - Make your changes
- Run tests:
swift test - Commit your changes
- Push to your fork
- Open a Pull Request
- macOS 14.0 or later
- Xcode 16.0 or later (for Swift 6.2 support)
- Apple Silicon Mac (M1, M2, M3, M4, or later)
DICOMKit follows standard Swift conventions with these specific requirements:
- Use 4 spaces for indentation (no tabs)
- Maximum line length: 120 characters
- Use Swift's standard naming conventions (camelCase for variables/functions, PascalCase for types)
- All public types, properties, and methods must have doc comments (
///) - Include parameter and return value documentation
- Cite DICOM standard sections where applicable (e.g.,
/// Reference: PS3.5 Section 7.1)
- Prefer value types (
struct,enum) over reference types (class) - All public types must conform to
Sendablefor Swift 6 concurrency - Use
letovervarwherever possible - Avoid force unwrapping (
!) in library code - use optional chaining or proper error handling
/// Patient Name data element
///
/// Stores the patient's name in DICOM PN format (family^given^middle^prefix^suffix).
/// Reference: DICOM PS3.5 Section 6.2 - PN Value Representation
public struct PatientName: Sendable {
/// Family name component
public let familyName: String
/// Given name component
public let givenName: String
/// Creates a patient name
/// - Parameters:
/// - familyName: Family name
/// - givenName: Given name
public init(familyName: String, givenName: String) {
self.familyName = familyName
self.givenName = givenName
}
}This is critical: DICOMKit must faithfully implement the DICOM standard.
- Use DICOM 2026a only - Do not reference older editions
- Cite sections - All parsing behavior must cite specific PS3.x sections
- No translation - Do not port code from other libraries (DCMTK, pydicom, fo-dicom)
- Authoritative sources:
- Use DICOM XML for structure definitions (PS3.6)
- Use DICOM PS3.5 text for parsing and encoding rules
- Never invent - If the standard doesn't specify behavior, ask or leave it unimplemented
// CORRECT
/// Reads the Value Length field.
/// For VRs with 16-bit length, reads 2 bytes (PS3.5 Section 7.1.2).
/// For VRs with 32-bit length, skips 2 reserved bytes then reads 4 bytes (PS3.5 Section 7.1.2).
// INCORRECT
/// Reads the length field (like pydicom does)- All new features must include tests
- Use Swift Testing framework (
@Test,#expect) - Organize tests by module (DICOMCoreTests, DICOMDictionaryTests, DICOMKitTests)
- Test both success and failure cases
- Test edge cases (empty data, maximum values, etc.)
swift testDICOMKit uses GitHub Actions for automated testing and validation:
-
CI Workflow: Runs on every push and pull request
- Builds the package on multiple Xcode versions
- Runs the comprehensive test suite (1,464+ tests)
- Validates code quality and compiler warnings
- Tests platform compatibility (iOS, macOS, visionOS)
-
Scheduled Tests: Runs weekly on Mondays
- Comprehensive test suite with verbose output
- Memory leak detection with sanitizers
- Performance benchmarking
- Dependency update checks
-
Documentation Build: Deploys to GitHub Pages on main branch updates
- Builds DocC documentation for all modules
- Creates searchable API reference
-
Release Workflow: Triggered on version tags (v*..)
- Builds and packages CLI tools
- Creates GitHub releases with artifacts
- Generates release notes
All CI workflows are located in .github/workflows/:
ci.yml- Main continuous integrationscheduled-tests.yml- Weekly comprehensive testingdocs.yml- Documentation deploymentrelease.yml- Release automation
Before submitting a PR, ensure your changes pass locally:
# Build the project
swift build
# Run all tests
swift test
# Build in release mode
swift build -c releaseThe CI will automatically run these checks when you open a pull request.
import Testing
@testable import DICOMCore
@Suite("Tag Tests")
struct TagTests {
@Test("Private tag detection")
func testPrivateTagDetection() {
let privateTag = Tag(group: 0x0011, element: 0x0010)
#expect(privateTag.isPrivate == true)
let standardTag = Tag(group: 0x0010, element: 0x0010)
#expect(standardTag.isPrivate == false)
}
}- Update documentation - If you change public API, update README.md and doc comments
- Add tests - All new functionality must be tested
- Cite DICOM standard - Include PS3.x section references in code comments
- Run tests - Ensure
swift testpasses - Keep PRs focused - One feature or fix per PR
- Write clear commit messages - Explain what and why, not just what
Brief summary (50 chars or less)
More detailed explanation if needed. Wrap at 72 characters.
- List specific changes
- Reference DICOM sections if applicable
- Link to issues: Fixes #123
- Additional data element dictionary entries from PS3.6 2026a
- Additional UID dictionary entries
- Bug fixes
- Documentation improvements
- Test coverage improvements
- DICOMweb services (WADO-RS, QIDO-RS, STOW-RS)
- Structured Reporting (SR documents)
- Presentation State support
- Extended character set support (beyond UTF-8)
- Features outside DICOM 2026a specification
- Changes that break Apple platform compatibility
- Changes that remove strict concurrency support
- Dependencies on third-party libraries (prefer pure Swift)
- Open an issue for bugs or feature requests
- Start a discussion for questions or ideas
- Tag maintainers for urgent issues
By contributing to DICOMKit, you agree that your contributions will be licensed under the MIT License.
Thank you for helping make DICOMKit better!