Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Representing physical hierarchy in MRdataset #12

Open
sinhaharsh opened this issue Apr 14, 2023 · 2 comments
Open

Representing physical hierarchy in MRdataset #12

sinhaharsh opened this issue Apr 14, 2023 · 2 comments

Comments

@sinhaharsh
Copy link
Collaborator

sinhaharsh commented Apr 14, 2023

sample script below - it should be super easy for you to follow, i’ll show it to you and document is better later:

from pathlib import Path

from MRdataset.experiment import DicomDataset

base_dir = Path('/Users/Reddy/Downloads/dicom')
ds_name = 'vertical_subset_ABCD'  # 'ABCD'  # 'wpc7888'  #  'test_data'
dcm_root = base_dir / ds_name

# dcm_root = Path('/Users/Reddy/Downloads/dicom/wpc7888/2023.01.19-14.16.55/50250')

ds = DicomDataset(root=dcm_root, pattern='*', name=ds_name)
ds.load(refresh=False)

s1 = 'ABCD-Diffusion-FM-AP,_SIEMENS,_original_(baseline_year_1_arm_1)'
s2 = 'ABCD-Diffusion-FM-PA,_SIEMENS,_original_(baseline_year_1_arm_1)'

for subj, sess, r1, r2, seq1, seq2 in ds.traverse_vertical2(s1, s2):
    print(f'\n{subj} {sess:3} \n\t{str(seq1):>120} \n\t{str(seq2):>120}')

three_seqs = ['ABCD-DTI,_SIEMENS,_mosaic,_original_(baseline_year_1_arm_1)',
              'ABCD-Diffusion-FM-PA,_SIEMENS,_original_(baseline_year_1_arm_1)',
              'ABCD-Diffusion-FM-AP,_SIEMENS,_original_(baseline_year_1_arm_1)']

for subj, sess, runs, seqs in ds.traverse_vertical_multi(*three_seqs):
    print(f'\n{subj} {sess:3}')
    for rr, ss in zip(runs, seqs):
        print(f'\t{str(ss):>120}\t{rr}')


for seq in ds._seq_ids:
    print(f'\n{seq}')
    for subj, sess, run, seq in ds.traverse_horizontal(seq):
        print(f'\t {subj} {sess} {run}')


print('')

Slack

@sinhaharsh
Copy link
Collaborator Author

sinhaharsh commented Apr 14, 2023

you’d need the protocol locally installed - Fork and clone and installed it as editable after checking out imaging_params_seq_classes branch with pip install -e .

https://github.com/raamana/protocol/tree/imaging_params_seq_classes

@sinhaharsh
Copy link
Collaborator Author

Test script for the new classes (protocol). Going forward, we need to start adopting these classes and start implementing vertical audits soon

Reference : Slack

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant