File tree Expand file tree Collapse file tree
src/Magick.NET/Formats/Dcm
tests/Magick.NET.Tests/Formats/Dcm/DcmReadDefinesTests Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -10,6 +10,11 @@ namespace ImageMagick.Formats;
1010/// </summary>
1111public sealed class DcmReadDefines : IReadDefines
1212{
13+ /// <summary>
14+ /// Gets or sets a value indicating whether the byte order of the pixels should be fixed (dcm:fix-byte-order).
15+ /// </summary>
16+ public bool ? FixByteOrder { get ; set ; }
17+
1318 /// <summary>
1419 /// Gets the format where the defines are for.
1520 /// </summary>
@@ -44,6 +49,9 @@ public IEnumerable<IDefine> Defines
4449 {
4550 get
4651 {
52+ if ( FixByteOrder . HasValue )
53+ yield return new MagickDefine ( Format , "fix-byte-order" , FixByteOrder . Value ) ;
54+
4755 if ( Rescale . HasValue )
4856 yield return new MagickDefine ( Format , "rescale" , Rescale . Value ) ;
4957
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ public void ShouldNotSetAnyDefines()
1717 using var image = new MagickImage ( ) ;
1818 image . Settings . SetDefines ( new DcmReadDefines ( ) ) ;
1919
20+ Assert . Null ( image . Settings . GetDefine ( MagickFormat . Dcm , "fix-byte-order" ) ) ;
2021 Assert . Null ( image . Settings . GetDefine ( MagickFormat . Dcm , "display-range" ) ) ;
2122 Assert . Null ( image . Settings . GetDefine ( MagickFormat . Dcm , "rescale" ) ) ;
2223 Assert . Null ( image . Settings . GetDefine ( MagickFormat . Dcm , "window" ) ) ;
Original file line number Diff line number Diff line change 1+ // Copyright Dirk Lemstra https://github.com/dlemstra/Magick.NET.
2+ // Licensed under the Apache License, Version 2.0.
3+
4+ using ImageMagick ;
5+ using ImageMagick . Formats ;
6+ using Xunit ;
7+
8+ namespace Magick . NET . Tests ;
9+
10+ public partial class DcmReadDefinesTests
11+ {
12+ public class TheFixByteOrderProperty
13+ {
14+ [ Fact ]
15+ public void ShoulBeSetWhenTheValueIsFalse ( )
16+ {
17+ var defines = new DcmReadDefines ( )
18+ {
19+ FixByteOrder = false ,
20+ } ;
21+
22+ using var image = new MagickImage ( ) ;
23+ image . Settings . SetDefines ( defines ) ;
24+
25+ Assert . Equal ( "false" , image . Settings . GetDefine ( MagickFormat . Dcm , "fix-byte-order" ) ) ;
26+ }
27+
28+ [ Fact ]
29+ public void ShouldBeSetWhenTheValueIsTrue ( )
30+ {
31+ var defines = new DcmReadDefines ( )
32+ {
33+ FixByteOrder = true ,
34+ } ;
35+
36+ using var image = new MagickImage ( ) ;
37+ image . Settings . SetDefines ( defines ) ;
38+
39+ Assert . Equal ( "true" , image . Settings . GetDefine ( MagickFormat . Dcm , "fix-byte-order" ) ) ;
40+ }
41+ }
42+ }
You can’t perform that action at this time.
0 commit comments