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

Sample code snippet error #6

Closed
jithenece opened this issue Apr 30, 2024 · 3 comments
Closed

Sample code snippet error #6

jithenece opened this issue Apr 30, 2024 · 3 comments
Labels
documentation Improvements or additions to documentation

Comments

@jithenece
Copy link

I tried to run the example from README.md and got exception

from segdb.tools import DcmqiDsegConfigGenerator

# generate json meta generator instance
generator = DcmqiDsegConfigGenerator(
    model_name = 'My Model',
    body_part_examined = 'CHEST'
)

# add segmentation
generator.addItem(
    file = 'path/to/segmentation.nii.gz',
    segment_ids = 'HEART',
    model_name = 'My Model'
)

# save json
generator.save('path/to/meta.json')

Error details below
raise Exception("Invalid segment ids: " + ', '.join(item.malformed_segment_ids or [])) Exception: Invalid segment ids: H, E, A, R, T

I tried on python3.10 and python3.12

@jithenece
Copy link
Author

segment_ids needs to be passed ['HEART'] instead of 'HEART'

@LennyN95 LennyN95 added the documentation Improvements or additions to documentation label May 6, 2024
@LennyN95
Copy link
Member

LennyN95 commented May 6, 2024

You're right, segdb IDs need to be passed as a list of strings into segment_ids. The example code is outdated and I will fix this. Thank you @jithenece for taking the time and opening this issue!

@LennyN95
Copy link
Member

LennyN95 commented May 6, 2024

Fixed in f165a6c.

@LennyN95 LennyN95 closed this as completed May 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants