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 dcm:window option #484

Merged
merged 2 commits into from May 10, 2017

Conversation

Projects
None yet
2 participants
@jcupitt
Contributor

jcupitt commented May 10, 2017

This patch adds a new dcm:window option which lets you override the
window center and width stored in the DICOM file with a new centerXwidth
pair. You can also use centerX or Xwidth. The window settings are ony
applied if the dcm:rescale option is enabled.

This is useful for transforming images from scan units to display units for
visualisation.

Example:

convert -define dcm:rescale -define dcm:window=2500x3000 MRIm5.dcm x.tif

This patch also reverts an earlier change which moved the transform for
signed data into the main path. Window handling assumes a 0 - max_value
output range and takes no account of signedness of the data, so
the subtract for signed data is not appropriate. Perhaps it should be,
but we'd need to track min_value as well, and that's beyound the scope
of this PR.

Related PR:

#483

DICOM spec:

https://www.dabsoft.ch/dicom/3/C.11.2.1.2/

add dcm:window option
This patch adds a new `dcm:window` option which lets you override the
window center and width stored in the DICOM file with a new centerXwidth
pair. You can also use centerX or Xwidth. The window settings are ony
applied if the `dcm:rescale` option is enabled.

This is useful for transforming images from scan units to display units for
visualisation.

Example:

convert -define dcm:rescale -define dcm:window=2500x3000 MRIm5.dcm x.tif

This patch also reverts an earlier change which moved the transform for
signed data into the main path. Window handling assumes a 0 - `max_value`
output range and takes no account of signedness of the data, so
the subtract for signed data is not appropriate. Perhaps it should be,
but we'd need to track `min_value` as well, and that's beyound the scope
of this PR.

Related PR:

#483

DICOM spec:

https://www.dabsoft.ch/dicom/3/C.11.2.1.2/
Show outdated Hide outdated coders/dcm.c
Show outdated Hide outdated coders/dcm.c
Show outdated Hide outdated coders/dcm.c
@jcupitt

This comment has been minimized.

Show comment
Hide comment
@jcupitt

jcupitt May 10, 2017

Contributor

I had another thought about signedness. The .signed_data field of course refers to the input data (the data in the file), not the output. So the subtract should always happen, and it should happen before rescale processing. I'll make this change too.

Contributor

jcupitt commented May 10, 2017

I had another thought about signedness. The .signed_data field of course refers to the input data (the data in the file), not the output. So the subtract should always happen, and it should happen before rescale processing. I'll make this change too.

incorportate code review
code review changes, plus move signed data handling before rescale and window
processing

@dlemstra dlemstra merged commit 79984bc into ImageMagick:ImageMagick-6 May 10, 2017

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

dlemstra added a commit that referenced this pull request May 10, 2017

@dlemstra

This comment has been minimized.

Show comment
Hide comment
@dlemstra

dlemstra May 11, 2017

Member

Your changes have been merged (and I added the IsStringTrue check). Could you also send the pull request for IM7?

Member

dlemstra commented May 11, 2017

Your changes have been merged (and I added the IsStringTrue check). Could you also send the pull request for IM7?

@jcupitt

This comment has been minimized.

Show comment
Hide comment
@jcupitt

jcupitt May 11, 2017

Contributor

Ooop, sorry, I did make that change, I think I forgot to push it.

I'll try an IM7 patch that does the same thing.

Contributor

jcupitt commented May 11, 2017

Ooop, sorry, I did make that change, I think I forgot to push it.

I'll try an IM7 patch that does the same thing.

@jcupitt

This comment has been minimized.

Show comment
Hide comment
@jcupitt

jcupitt May 11, 2017

Contributor

I meant to say, I didn't write a note in the ChangeLog, nor any docs or tests. Do they need doing too?

Contributor

jcupitt commented May 11, 2017

I meant to say, I didn't write a note in the ChangeLog, nor any docs or tests. Do they need doing too?

@dlemstra

This comment has been minimized.

Show comment
Hide comment
@dlemstra

dlemstra May 11, 2017

Member

Forgot to mention that you should add something to the change log. And our website is in another repo. We have a page where we explain all the defines. Would love it if you could add something there for the two new options that you created.

Member

dlemstra commented May 11, 2017

Forgot to mention that you should add something to the change log. And our website is in another repo. We have a page where we explain all the defines. Would love it if you could add something there for the two new options that you created.

jcupitt added a commit to jcupitt/Website that referenced this pull request May 11, 2017

@jcupitt jcupitt referenced this pull request May 11, 2017

Merged

document new dcm options #1

@jcupitt

This comment has been minimized.

Show comment
Hide comment
@jcupitt

jcupitt May 11, 2017

Contributor

I added a note to the ChangeLog in this branch, hopefully you can just merge that too.

I added some docs to the website.

IM7 next!

Contributor

jcupitt commented May 11, 2017

I added a note to the ChangeLog in this branch, hopefully you can just merge that too.

I added some docs to the website.

IM7 next!

@jcupitt

This comment has been minimized.

Show comment
Hide comment
@jcupitt

jcupitt May 11, 2017

Contributor

IM7 PR: #485

Contributor

jcupitt commented May 11, 2017

IM7 PR: #485

@dlemstra

This comment has been minimized.

Show comment
Hide comment
@dlemstra

dlemstra May 11, 2017

Member

I don't see the push for that ChangeLog change?

Member

dlemstra commented May 11, 2017

I don't see the push for that ChangeLog change?

@jcupitt

This comment has been minimized.

Show comment
Hide comment
@jcupitt

jcupitt May 11, 2017

Contributor

I pushed it, but it looks like I have to open a new PR for github to see it. Hang on.

Contributor

jcupitt commented May 11, 2017

I pushed it, but it looks like I have to open a new PR for github to see it. Hang on.

dlemstra added a commit to ImageMagick/Website that referenced this pull request May 11, 2017

jsonn pushed a commit to jsonn/pkgsrc that referenced this pull request May 14, 2017

he
Upgrade to ImageMagick version 7.0.5-6.
Upstream changes:
2017-05-12  7.0.5-6 Cristy  <quetzlzacatenango@image...>
  * Release ImageMagick version 7.0.5-6, GIT revision 20039:9371904:20170512.

2017-05-10  7.0.5-6 John Cupitt <jcupitt@gmail.com>
  * Revise DICOM window and rescale handling (reference
    ImageMagick/ImageMagick#484)

2017-05-06  7.0.5-6 Cristy  <quetzlzacatenango@image...>
  * Restore the -alpha Shape option (reference
    https://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=31879).
  * Fix transient PDF bug (reference
    ImageMagick/ImageMagick#463).
  * The +opaque option now works on all channels (reference
    https://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=31862).
  * Ensure backwards compatibility for the -combine option (reference
    https://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=31855).
  * Check for EOF conditions for RLE image format.
  * Reset histogram page geometry (reference
    https://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=31920).

jsonn pushed a commit to jsonn/pkgsrc that referenced this pull request May 17, 2017

he
Upgrade ImageMagick6 from 6.9.7.9 to 6.9.8.5.
Pkgsrc changes:
Adapt to new version, PLIST (2 new files).

Upstream changes:
2017-05-12  6.9.8-5 Cristy  <quetzlzacatenango@image...>
  * Release ImageMagick version 6.9.8-5, GIT revision 11575:186b15d:20170512.

2017-05-10  6.9.8-5 John Cupitt <jcupitt@gmail.com>
  * Revise DICOM window and rescale handling (reference
    ImageMagick/ImageMagick#484)

2017-05-08  6.9.8-5 Cristy  <quetzlzacatenango@image...>
  * Fix transient PDF bug (reference
    ImageMagick/ImageMagick#463).
  * Check for EOF conditions for RLE image format.
  * Reset histogram page geometry (reference
    https://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=31920).

2017-04-24  6.9.8-4 Cristy  <quetzlzacatenango@image...>
  * Release ImageMagick version 6.9.8-4, GIT revision 11521:d7433aa:20170424.

2017-03-26  6.9.8-4 Cristy  <quetzlzacatenango@image...>
  * Minimize buffer copies to improve OpenCL performance.
  * Patch a PCD writer problem, dark pixels (reference
    https://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=3164).
  * Support ICC based PDF's (reference
    ImageMagick/ImageMagick#417).

2017-03-24  6.9.8-3 Cristy  <quetzlzacatenango@image...>
  * Release ImageMagick version 6.9.8-3, GIT revision 11444:3f523e5:20170324.

2017-03-20  6.9.8-3 Cristy  <quetzlzacatenango@image...>
  * MagickWand-config, use --cflags, not --clags (reference
    https://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=31602).
  * Respect -loop option for animate -window (reference
    https://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=31619).

2017-03-18  6.9.8-2 Cristy  <quetzlzacatenango@image...>
  * Release ImageMagick version 6.9.8-2, GIT revision 11436:a912791:20170318.

2017-03-14  6.9.8-2 Cristy  <quetzlzacatenango@image...>
  * Support namespaces for the security policy.

2017-03-11  6.9.8-1 Cristy  <quetzlzacatenango@image...>
  * Release ImageMagick version 6.9.8-1.

2017-03-03  6.9.8-0 Cristy  <quetzlzacatenango@image...>
  * Release ImageMagick version 6.9.8-0, GIT revision 11408:da91a7c:20170311.

2017-03-06  6.9.8-0 Cristy  <quetzlzacatenango@image...>
  * Respect throttle policy (reference
    ImageMagick/ImageMagick#393).
  * Support the -authenticate option for PDF (reference
    https://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=31530).

2017-03-03  6.9.7-10 Cristy  <quetzlzacatenango@image...>
  * Release ImageMagick version 6.9.7-10, GIT revision 11396:44b1bc6:20170303.

2017-02-21  6.9.7-10 Cristy  <quetzlzacatenango@image...>
  * Fix Spurious memory allocation message (reference
    https://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=31438).
  * Identical images should return inf for PSNR (reference
    https://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=31487).

dlemstra added a commit to ImageMagick/Website that referenced this pull request Aug 28, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment