diff --git a/ChangeLog b/ChangeLog index 93a5d3b8..6c8fbcbf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,7 @@ - revised nohalo - remove fading stuff from im_render() -- cleaner and simpler - configure spots support for "restrict" +- reset dcm:display-range on magick read to help DICOM 3/3/09 started 7.17.2 - im_magick2vips.c: allow funky bit depths, like 14 (thanks Mikkel) diff --git a/TODO b/TODO index 9e8489bb..2fb18497 100644 --- a/TODO +++ b/TODO @@ -1,3 +1,18 @@ +- need to set + + -define dcm:display-range=reset + + to stop window_width/_height screwing up our data in magick read + + + use + + SetImageOption (image_info, "dcm:display-range", "reset"); + + somewhere + + + - move im_shrink & friends to resample? diff --git a/libsrc/format/im_magick2vips.c b/libsrc/format/im_magick2vips.c index 53dbbef7..cc77202e 100644 --- a/libsrc/format/im_magick2vips.c +++ b/libsrc/format/im_magick2vips.c @@ -22,6 +22,8 @@ * - use image->attributes if GetNextImageAttribute() is missing * 3/3/09 * - allow funky bit depths, like 14 (thanks Mikkel) + * 17/3/09 + * - reset dcm:display-range to help DICOM read */ /* @@ -585,6 +587,15 @@ im_magick2vips( const char *filename, IMAGE *im ) if( !(read = read_new( filename, im )) ) return( -1 ); + /* When reading DICOM images, we want to ignore any + * window_center/_width setting, since it may put pixels outside the + * 0-65535 range and lose data. + * + * These window settings are attached as vips metadata, so our caller + * can interpret them if it wants. + */ + SetImageOption( read->image_info, "dcm:display-range", "reset" ); + read->image = ReadImage( read->image_info, &read->exception ); if( !read->image ) { im_error( "im_magick2vips", _( "unable to read file \"%s\"\n"