-
Notifications
You must be signed in to change notification settings - Fork 19
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
Add MR images and pixel_representation flag #1
Add MR images and pixel_representation flag #1
Conversation
@rickardholmberg @rickardraysearch Should be fine to merge now! |
Fix PEP8 warnings in build_dicom.py
Output from dciodvfy.exe: Error - Missing attribute Type 2 Required Element=<RadiopharmaceuticalInformationSequence> Module=<PETIsotope> Error - Missing attribute Type 2 Required Element=<PatientOrientationCodeSequence> Module=<NMPETPatientOrientation> Error - Missing attribute Type 2 Required Element=<PatientGantryRelationshipCodeSequence> Module=<NMPETPatientOrientation>
README.md
Outdated
@@ -3,7 +3,7 @@ dicomutils | |||
|
|||
A set of utilities for working with DICOM files. | |||
|
|||
The main utility is currently build_dicom, which can generate simple synthetic CT data, | |||
The main utility is currently build_dicom, which can generate simple synthetic CT data, MR data, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PET?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
build_dicom.py
Outdated
choices=['signed', 'unsigned'], | ||
help='signed: Stored pixel value type is int16, unsigned: Stored pixel value type is uint16.') | ||
parser.add_argument('--rescale-slope', dest='rescale_slope', type=float, | ||
help="""Set the rescale slope (defaults - CT: 1.0, MR: 1.0).""") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PET?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, removed slope/icept for MR so removed from here too.
build_dicom.py
Outdated
num_voxels=num_voxels, | ||
voxel_size=voxel_size, | ||
pixel_representation=pixel_representation, | ||
rescale_slope=rescale_slope, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rescale_slope seems undefined?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
build_dicom.py
Outdated
@@ -138,6 +219,8 @@ def __call__(self, parser, namespace, values, option_string=None): | |||
sb.current_study['PatientsBirthDate'] = series.patients_birthdate | |||
if series.modality == "CT": | |||
ib.build() | |||
elif series.modality == "MR": | |||
ib.build() | |||
elif series.modality == "RTDOSE": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PET too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
self.seriesbuilders['CT'].append(b) | ||
return b | ||
|
||
def build_mr(self, num_voxels, voxel_size, pixel_representation, center=None, column_direction=None, | ||
row_direction=None, slice_direction=None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rescale_slope & rescale_intercept?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
slope/icept not applicable for MR, it was a mistake to add it and it was later removed.
builders.py
Outdated
|
||
def build_pt(self, num_voxels, voxel_size, pixel_representation, center=None, column_direction=None, | ||
row_direction=None, slice_direction=None): | ||
b = PTBuilder(self.current_study, num_voxels, voxel_size, pixel_representation, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rescale_slope?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added
voxel_size, | ||
pixel_representation, | ||
center=None, | ||
column_direction=None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rescale_slope & rescale_intercept?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not applicable for MR
num_voxels, | ||
voxel_size, | ||
pixel_representation, | ||
center=None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rescale_slope?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
I think going forward it is risky to use default arguments in "backend" code, better to handle that kind of stuff in build_dicom.py. Otherwise there is a risk that the values are not passed down correctly without generating errors... |
ping @rickardraysearch |
Unexpectedly, I was allowed to push to this branch. Sorry for that - the last commit 3d8488c was only intended to be pull request comments... Other than that, it looks good! |
Ok, feel free to merge (I don't have write access). |
@rickardraysearch
Verified created images with dciodvfy.exe.