feat: add CsaHeader.from_dicom() convenience method #37
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Implements issue #16 by adding a
CsaHeader.from_dicom()convenience method for extracting CSA headers directly from DICOM datasets without requiring knowledge of exact DICOM tag numbers.Features
'image'and'series'CSA header typescsa_typeparameter, returnsNonegracefully when headers not presentLiteral['image', 'series']for IDE autocompleteImplementation Details
Core Changes
CsaHeader.from_dicom(dcm_data, csa_type='image')classmethodCsaHeader.CSA_TAGSclass constant mapping header types to DICOM tagsCsaHeader._extract_csa_bytes()private helper methodget_csa_header()functionTesting
tests/test_dicom_integration.pyheader.pycoverage: 99%Documentation
from_dicom()Build Configuration
pydicom>=2.2.0to lint environment for proper type checkingUsage Example
Quality Metrics
Attribution
get_csa_header()approachBreaking Changes
None - this is a new feature that doesn't affect existing functionality.
Closes
Closes #16
🤖 Generated with Claude Code