Skip to content

How to create nested DataElement? #351

Answered by Enet4
qarmin asked this question in Q&A
Discussion options

You must be logged in to vote

Hmm, it's a type mismatch in the DICOM object type parameters. The first one is for nested data sets, the second one for pixel data fragments. The helper constructor new_sequence is being unnecessarily strict right now, so the way to fix this is to build the sequence value manually.

let scheduled_procedure_step_sequence = DataElement::new(
    tags::SCHEDULED_PROCEDURE_STEP_SEQUENCE,
    VR::SQ,
    Value::Sequence {
        items: smallvec![scheduled_procedure_step_sequence_set],
        size: Length::UNDEFINED
    },
);
obj.put(scheduled_procedure_step_sequence);

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@Enet4
Comment options

Enet4 Jun 2, 2023
Maintainer

Answer selected by qarmin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
C-object Crate: dicom-object
2 participants