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

Add MR images and pixel_representation flag #1

Merged

Conversation

thinks
Copy link
Contributor

@thinks thinks commented Feb 8, 2017

@rickardraysearch

Verified created images with dciodvfy.exe.

@thinks
Copy link
Contributor Author

thinks commented Feb 10, 2017

@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,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PET?

Copy link
Contributor Author

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).""")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PET?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

Copy link
Contributor Author

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,
Copy link
Contributor

@rickardraysearch rickardraysearch Feb 16, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rescale_slope seems undefined?

Copy link
Contributor Author

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":
Copy link
Contributor

@rickardraysearch rickardraysearch Feb 16, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PET too?

Copy link
Contributor Author

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):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rescale_slope & rescale_intercept?

Copy link
Contributor Author

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,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rescale_slope?

Copy link
Contributor Author

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,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rescale_slope & rescale_intercept?

Copy link
Contributor Author

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,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rescale_slope?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@thinks
Copy link
Contributor Author

thinks commented Feb 16, 2017

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...

@thinks
Copy link
Contributor Author

thinks commented Mar 6, 2017

ping @rickardraysearch

@rickardraysearch
Copy link
Contributor

rickardraysearch commented Mar 6, 2017

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!

@thinks
Copy link
Contributor Author

thinks commented Mar 7, 2017

Ok, feel free to merge (I don't have write access).

@rickardraysearch rickardraysearch merged commit 6ac41c4 into raysearchlabs:master Mar 7, 2017
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

Successfully merging this pull request may close these issues.

2 participants