@@ -11,45 +11,80 @@ itkConfig.imageIOsPath = path.resolve(__dirname, '..', 'dist', 'itkImageIOs')
1111test ( 'Test reading a PNG file' , t => {
1212 const testFilePath = path . resolve ( __dirname , '..' , 'build' , 'ExternalData' , 'test' , 'Input' , 'cthead1.png' )
1313 return readImageLocalFile ( testFilePath ) . then ( function ( image ) {
14- t . is ( image . imageType . dimension , 2 )
15- t . is ( image . imageType . componentType , IntTypes . UInt8 )
16- t . is ( image . imageType . pixelType , PixelTypes . RGB )
17- t . is ( image . imageType . components , 3 )
18- t . is ( image . origin [ 0 ] , 0.0 )
19- t . is ( image . origin [ 1 ] , 0.0 )
20- t . is ( image . spacing [ 0 ] , 1.0 )
21- t . is ( image . spacing [ 1 ] , 1.0 )
22- t . is ( image . direction . getElement ( 0 , 0 ) , 1.0 )
23- t . is ( image . direction . getElement ( 0 , 1 ) , 0.0 )
24- t . is ( image . direction . getElement ( 1 , 0 ) , 0.0 )
25- t . is ( image . direction . getElement ( 1 , 1 ) , 1.0 )
26- t . is ( image . size [ 0 ] , 256 )
27- t . is ( image . size [ 1 ] , 256 )
28- t . is ( image . buffer . length , 196608 )
14+ t . is ( image . imageType . dimension , 2 , 'dimension' )
15+ t . is ( image . imageType . componentType , IntTypes . UInt8 , 'componentType' )
16+ t . is ( image . imageType . pixelType , PixelTypes . RGB , 'pixelType' )
17+ t . is ( image . imageType . components , 3 , 'components' )
18+ t . is ( image . origin [ 0 ] , 0.0 , 'origin[0]' )
19+ t . is ( image . origin [ 1 ] , 0.0 , 'origin[1]' )
20+ t . is ( image . spacing [ 0 ] , 1.0 , 'spacing[0]' )
21+ t . is ( image . spacing [ 1 ] , 1.0 , 'spacing[1]' )
22+ t . is ( image . direction . getElement ( 0 , 0 ) , 1.0 , 'direction (0, 0)' )
23+ t . is ( image . direction . getElement ( 0 , 1 ) , 0.0 , 'direction (0, 1)' )
24+ t . is ( image . direction . getElement ( 1 , 0 ) , 0.0 , 'direction (1, 0)' )
25+ t . is ( image . direction . getElement ( 1 , 1 ) , 1.0 , 'direction (1, 1)' )
26+ t . is ( image . size [ 0 ] , 256 , 'size[0]' )
27+ t . is ( image . size [ 1 ] , 256 , 'size[1]' )
28+ t . is ( image . buffer . length , 196608 , 'buffer.length' )
2929 } )
3030} )
3131
3232test ( 'Test reading a NRRD file' , t => {
3333 const testFilePath = path . resolve ( __dirname , '..' , 'build' , 'ExternalData' , 'test' , 'Input' , 'vol-raw-little.nrrd' )
3434 return readImageLocalFile ( testFilePath ) . then ( function ( image ) {
35- t . is ( image . imageType . dimension , 3 )
36- t . is ( image . imageType . componentType , FloatTypes . Float64 )
35+ t . is ( image . imageType . dimension , 3 , 'dimension' )
36+ t . is ( image . imageType . componentType , FloatTypes . Float64 , 'componentType' )
37+ t . is ( image . imageType . pixelType , PixelTypes . Scalar , 'pixelType' )
38+ t . is ( image . imageType . components , 1 , 'components' )
39+ t . is ( image . origin [ 0 ] , 0.0 , 'origin[0]' )
40+ t . is ( image . origin [ 1 ] , 0.0 , 'origin[1]' )
41+ t . is ( image . origin [ 2 ] , 0.0 , 'origin[2]' )
42+ t . is ( image . spacing [ 0 ] , 1.0 , 'spacing[0]' )
43+ t . is ( image . spacing [ 1 ] , 1.0 , 'spacing[1]' )
44+ t . is ( image . spacing [ 2 ] , 1.0 , 'spacing[2]' )
45+ t . is ( image . direction . getElement ( 0 , 0 ) , 1.0 , 'direction (0, 0)' )
46+ t . is ( image . direction . getElement ( 0 , 1 ) , 0.0 , 'direction (0, 1)' )
47+ t . is ( image . direction . getElement ( 0 , 2 ) , 0.0 , 'direction (0, 2)' )
48+ t . is ( image . direction . getElement ( 1 , 0 ) , 0.0 , 'direction (1, 0)' )
49+ t . is ( image . direction . getElement ( 1 , 1 ) , 1.0 , 'direction (1, 1)' )
50+ t . is ( image . direction . getElement ( 1 , 2 ) , 0.0 , 'direction (1, 2)' )
51+ t . is ( image . direction . getElement ( 2 , 0 ) , 0.0 , 'direction (2, 0)' )
52+ t . is ( image . direction . getElement ( 2 , 1 ) , 0.0 , 'direction (2, 1)' )
53+ t . is ( image . direction . getElement ( 2 , 2 ) , 1.0 , 'direction (2, 2)' )
54+ t . is ( image . size [ 0 ] , 5 , 'size[0]' )
55+ t . is ( image . size [ 1 ] , 6 , 'size[1]' )
56+ t . is ( image . size [ 2 ] , 7 , 'size[2]' )
57+ t . is ( image . buffer . length , 210 , 'buffer.length' )
58+ t . is ( image . buffer [ 2 ] , 5.0 , 'buffer[2]' )
59+ } )
60+ } )
61+
62+ test ( 'Test reading a DICOM file' , t => {
63+ const testFilePath = path . resolve ( __dirname , '..' , 'build' , 'ExternalData' , 'test' , 'Input' , '1.3.6.1.4.1.5962.99.1.3814087073.479799962.1489872804257.100.0.dcm' )
64+ return readImageLocalFile ( testFilePath ) . then ( function ( image ) {
65+ t . is ( image . imageType . dimension , 3 , 'dimension' )
66+ t . is ( image . imageType . componentType , IntTypes . Int16 )
3767 t . is ( image . imageType . pixelType , PixelTypes . Scalar )
3868 t . is ( image . imageType . components , 1 )
39- t . is ( image . origin [ 0 ] , 0.0 )
40- t . is ( image . origin [ 1 ] , 0.0 )
41- t . is ( image . origin [ 2 ] , 0.0 )
69+ t . is ( image . origin [ 0 ] , - 32.9551 )
70+ t . is ( image . origin [ 1 ] , - 133.9286 )
71+ t . is ( image . origin [ 2 ] , 116.7857 )
4272 t . is ( image . spacing [ 0 ] , 1.0 )
4373 t . is ( image . spacing [ 1 ] , 1.0 )
4474 t . is ( image . spacing [ 2 ] , 1.0 )
45- t . is ( image . direction . getElement ( 0 , 0 ) , 1.0 )
46- t . is ( image . direction . getElement ( 0 , 1 ) , 0.0 )
47- t . is ( image . direction . getElement ( 1 , 0 ) , 0.0 )
48- t . is ( image . direction . getElement ( 1 , 1 ) , 1.0 )
49- t . is ( image . size [ 0 ] , 5 )
50- t . is ( image . size [ 1 ] , 6 )
51- t . is ( image . size [ 2 ] , 7 )
52- t . is ( image . buffer . length , 210 )
53- t . is ( image . buffer [ 2 ] , 5.0 )
75+ t . is ( image . direction . getElement ( 0 , 0 ) , 0.0 , 'direction (0, 0)' )
76+ t . is ( image . direction . getElement ( 0 , 1 ) , 0.0 , 'direction (0, 1)' )
77+ t . is ( image . direction . getElement ( 0 , 2 ) , - 1.0 , 'direction (0, 2)' )
78+ t . is ( image . direction . getElement ( 1 , 0 ) , 1.0 , 'direction (1, 0)' )
79+ t . is ( image . direction . getElement ( 1 , 1 ) , 0.0 , 'direction (1, 1)' )
80+ t . is ( image . direction . getElement ( 1 , 2 ) , 0.0 , 'direction (1, 2)' )
81+ t . is ( image . direction . getElement ( 2 , 0 ) , 0.0 , 'direction (2, 0)' )
82+ t . is ( image . direction . getElement ( 2 , 1 ) , - 1.0 , 'direction (2, 1)' )
83+ t . is ( image . direction . getElement ( 2 , 2 ) , 0.0 , 'direction (2, 2)' )
84+ t . is ( image . size [ 0 ] , 256 , 'size[0]' )
85+ t . is ( image . size [ 1 ] , 256 , 'size[1]' )
86+ t . is ( image . size [ 2 ] , 1 , 'size[2]' )
87+ t . is ( image . buffer . length , 65536 , 'buffer.length' )
88+ t . is ( image . buffer [ 1000 ] , 3 , 'buffer[1000]' )
5489 } )
5590} )
0 commit comments