@@ -52,64 +52,64 @@ def get_data(self, _obj):
5252 return np .zeros ((1 , 1 , 1 )), {"name" : "my test" }
5353
5454
55- TEST_CASE_1 = [{}, ["test_image.nii.gz" ], (128 , 128 , 128 )]
55+ TEST_CASE_1 = [{}, ["test_image.nii.gz" ], (32 , 32 , 32 )]
5656
57- TEST_CASE_2 = [{}, ["test_image.nii.gz" ], (128 , 128 , 128 )]
57+ TEST_CASE_2 = [{}, ["test_image.nii.gz" ], (32 , 32 , 32 )]
5858
59- TEST_CASE_3 = [{}, ["test_image.nii.gz" , "test_image2.nii.gz" , "test_image3.nii.gz" ], (3 , 128 , 128 , 128 )]
59+ TEST_CASE_3 = [{}, ["test_image.nii.gz" , "test_image2.nii.gz" , "test_image3.nii.gz" ], (3 , 32 , 32 , 32 )]
6060
6161TEST_CASE_3_1 = [ # .mgz format
6262 {"reader" : "nibabelreader" },
6363 ["test_image.mgz" , "test_image2.mgz" , "test_image3.mgz" ],
64- (3 , 128 , 128 , 128 ),
64+ (3 , 32 , 32 , 32 ),
6565]
6666
67- TEST_CASE_4 = [{}, ["test_image.nii.gz" , "test_image2.nii.gz" , "test_image3.nii.gz" ], (3 , 128 , 128 , 128 )]
67+ TEST_CASE_4 = [{}, ["test_image.nii.gz" , "test_image2.nii.gz" , "test_image3.nii.gz" ], (3 , 32 , 32 , 32 )]
6868
6969TEST_CASE_4_1 = [ # additional parameter
7070 {"mmap" : False },
7171 ["test_image.nii.gz" , "test_image2.nii.gz" , "test_image3.nii.gz" ],
72- (3 , 128 , 128 , 128 ),
72+ (3 , 32 , 32 , 32 ),
7373]
7474
75- TEST_CASE_5 = [{"reader" : NibabelReader (mmap = False )}, ["test_image.nii.gz" ], (128 , 128 , 128 )]
75+ TEST_CASE_5 = [{"reader" : NibabelReader (mmap = False )}, ["test_image.nii.gz" ], (32 , 32 , 32 )]
7676
77- TEST_CASE_GPU_1 = [{"reader" : "nibabelreader" , "to_gpu" : True }, ["test_image.nii.gz" ], (128 , 128 , 128 )]
77+ TEST_CASE_GPU_1 = [{"reader" : "nibabelreader" , "to_gpu" : True }, ["test_image.nii.gz" ], (32 , 32 , 32 )]
7878
79- TEST_CASE_GPU_2 = [{"reader" : "nibabelreader" , "to_gpu" : True }, ["test_image.nii" ], (128 , 128 , 128 )]
79+ TEST_CASE_GPU_2 = [{"reader" : "nibabelreader" , "to_gpu" : True }, ["test_image.nii" ], (32 , 32 , 32 )]
8080
8181TEST_CASE_GPU_3 = [
8282 {"reader" : "nibabelreader" , "to_gpu" : True },
8383 ["test_image.nii" , "test_image2.nii" , "test_image3.nii" ],
84- (3 , 128 , 128 , 128 ),
84+ (3 , 32 , 32 , 32 ),
8585]
8686
8787TEST_CASE_GPU_4 = [
8888 {"reader" : "nibabelreader" , "to_gpu" : True },
8989 ["test_image.nii.gz" , "test_image2.nii.gz" , "test_image3.nii.gz" ],
90- (3 , 128 , 128 , 128 ),
90+ (3 , 32 , 32 , 32 ),
9191]
9292
93- TEST_CASE_6 = [{"reader" : ITKReader () if has_itk else "itkreader" }, ["test_image.nii.gz" ], (128 , 128 , 128 )]
93+ TEST_CASE_6 = [{"reader" : ITKReader () if has_itk else "itkreader" }, ["test_image.nii.gz" ], (32 , 32 , 32 )]
9494
95- TEST_CASE_7 = [{"reader" : ITKReader () if has_itk else "itkreader" }, ["test_image.nii.gz" ], (128 , 128 , 128 )]
95+ TEST_CASE_7 = [{"reader" : ITKReader () if has_itk else "itkreader" }, ["test_image.nii.gz" ], (32 , 32 , 32 )]
9696
9797TEST_CASE_8 = [
9898 {"reader" : ITKReader () if has_itk else "itkreader" },
9999 ["test_image.nii.gz" , "test_image2.nii.gz" , "test_image3.nii.gz" ],
100- (3 , 128 , 128 , 128 ),
100+ (3 , 32 , 32 , 32 ),
101101]
102102
103103TEST_CASE_8_1 = [
104104 {"reader" : ITKReader (channel_dim = 0 ) if has_itk else "itkreader" },
105105 ["test_image.nii.gz" , "test_image2.nii.gz" , "test_image3.nii.gz" ],
106- (384 , 128 , 128 ),
106+ (96 , 32 , 32 ),
107107]
108108
109109TEST_CASE_9 = [
110110 {"reader" : ITKReader () if has_itk else "itkreader" },
111111 ["test_image.nii.gz" , "test_image2.nii.gz" , "test_image3.nii.gz" ],
112- (3 , 128 , 128 , 128 ),
112+ (3 , 32 , 32 , 32 ),
113113]
114114
115115TEST_CASE_10 = [
@@ -128,24 +128,24 @@ def get_data(self, _obj):
128128 (4 , 16 , 16 ),
129129]
130130
131- TEST_CASE_13 = [{"reader" : "nibabelreader" , "channel_dim" : 0 }, "test_image.nii.gz" , (3 , 128 , 128 , 128 )]
131+ TEST_CASE_13 = [{"reader" : "nibabelreader" , "channel_dim" : 0 }, "test_image.nii.gz" , (3 , 32 , 32 , 32 )]
132132
133133TEST_CASE_14 = [
134134 {"reader" : "nibabelreader" , "channel_dim" : - 1 , "ensure_channel_first" : True },
135135 "test_image.nii.gz" ,
136- (128 , 128 , 128 , 3 ),
136+ (32 , 32 , 32 , 3 ),
137137]
138138
139- TEST_CASE_15 = [{"reader" : "nibabelreader" , "channel_dim" : 2 }, "test_image.nii.gz" , (128 , 128 , 3 , 128 )]
139+ TEST_CASE_15 = [{"reader" : "nibabelreader" , "channel_dim" : 2 }, "test_image.nii.gz" , (32 , 32 , 3 , 32 )]
140140
141- TEST_CASE_16 = [{"reader" : "itkreader" , "channel_dim" : 0 }, "test_image.nii.gz" , (3 , 128 , 128 , 128 )]
141+ TEST_CASE_16 = [{"reader" : "itkreader" , "channel_dim" : 0 }, "test_image.nii.gz" , (3 , 32 , 32 , 32 )]
142142
143- TEST_CASE_17 = [{"reader" : "monai.data.ITKReader" , "channel_dim" : - 1 }, "test_image.nii.gz" , (128 , 128 , 128 , 3 )]
143+ TEST_CASE_17 = [{"reader" : "monai.data.ITKReader" , "channel_dim" : - 1 }, "test_image.nii.gz" , (32 , 32 , 32 , 3 )]
144144
145145TEST_CASE_18 = [
146146 {"reader" : "ITKReader" , "channel_dim" : 2 , "ensure_channel_first" : True },
147147 "test_image.nii.gz" ,
148- (128 , 128 , 3 , 128 ),
148+ (32 , 32 , 3 , 32 ),
149149]
150150
151151# test same dicom data with PydicomReader
@@ -180,8 +180,8 @@ def get_data(self, _obj):
180180
181181TESTS_META = []
182182for track_meta in (False , True ):
183- TESTS_META .append ([{}, (128 , 128 , 128 ), track_meta ])
184- TESTS_META .append ([{"reader" : "ITKReader" , "fallback_only" : False }, (128 , 128 , 128 ), track_meta ])
183+ TESTS_META .append ([{}, (32 , 32 , 32 ), track_meta ])
184+ TESTS_META .append ([{"reader" : "ITKReader" , "fallback_only" : False }, (32 , 32 , 32 ), track_meta ])
185185
186186
187187@unittest .skipUnless (has_itk , "itk not installed" )
@@ -209,7 +209,7 @@ def tearDownClass(cls):
209209 [TEST_CASE_1 , TEST_CASE_2 , TEST_CASE_3 , TEST_CASE_3_1 , TEST_CASE_4 , TEST_CASE_4_1 , TEST_CASE_5 ]
210210 )
211211 def test_nibabel_reader (self , input_param , filenames , expected_shape ):
212- test_image = np .random .rand (128 , 128 , 128 )
212+ test_image = np .random .rand (32 , 32 , 32 )
213213 with tempfile .TemporaryDirectory () as tempdir :
214214 for i , name in enumerate (filenames ):
215215 filenames [i ] = os .path .join (tempdir , name )
@@ -229,9 +229,9 @@ def test_nibabel_reader_gpu(self, input_param, filenames, expected_shape):
229229 if torch .__version__ .endswith ("nv24.8" ):
230230 # related issue: https://github.com/Project-MONAI/MONAI/issues/8274
231231 # for this version, use randint test case to avoid the issue
232- test_image = torch .randint (0 , 256 , (128 , 128 , 128 ), dtype = torch .uint8 ).numpy ()
232+ test_image = torch .randint (0 , 256 , (32 , 32 , 32 ), dtype = torch .uint8 ).numpy ()
233233 else :
234- test_image = np .random .rand (128 , 128 , 128 )
234+ test_image = np .random .rand (32 , 32 , 32 )
235235 with tempfile .TemporaryDirectory () as tempdir :
236236 for i , name in enumerate (filenames ):
237237 filenames [i ] = os .path .join (tempdir , name )
@@ -251,7 +251,7 @@ def test_nibabel_reader_gpu(self, input_param, filenames, expected_shape):
251251
252252 @parameterized .expand ([TEST_CASE_6 , TEST_CASE_7 , TEST_CASE_8 , TEST_CASE_8_1 , TEST_CASE_9 ])
253253 def test_itk_reader (self , input_param , filenames , expected_shape ):
254- test_image = torch .randint (0 , 256 , (128 , 128 , 128 ), dtype = torch .uint8 ).numpy ()
254+ test_image = torch .randint (0 , 256 , (32 , 32 , 32 ), dtype = torch .uint8 ).numpy ()
255255 print ("Test image value range:" , test_image .min (), test_image .max ())
256256 with tempfile .TemporaryDirectory () as tempdir :
257257 for i , name in enumerate (filenames ):
@@ -462,7 +462,7 @@ def test_channel_dim(self, input_param, filename, expected_shape):
462462 result = LoadImage (image_only = True , ** input_param )(filename ) # with itk, meta has 'qto_xyz': itkMatrixF44
463463
464464 self .assertTupleEqual (
465- result .shape , (3 , 128 , 128 , 128 ) if input_param .get ("ensure_channel_first" , False ) else expected_shape
465+ result .shape , (3 , 32 , 32 , 32 ) if input_param .get ("ensure_channel_first" , False ) else expected_shape
466466 )
467467 self .assertEqual (result .meta ["original_channel_dim" ], input_param ["channel_dim" ])
468468
@@ -473,7 +473,7 @@ class TestLoadImageMeta(unittest.TestCase):
473473 def setUpClass (cls ):
474474 super ().setUpClass ()
475475 cls .tmpdir = tempfile .mkdtemp ()
476- test_image = nib .Nifti1Image (np .random .rand (128 , 128 , 128 ), np .eye (4 ))
476+ test_image = nib .Nifti1Image (np .random .rand (32 , 32 , 32 ), np .eye (4 ))
477477 nib .save (test_image , os .path .join (cls .tmpdir , "im.nii.gz" ))
478478 cls .test_data = os .path .join (cls .tmpdir , "im.nii.gz" )
479479
@@ -502,7 +502,7 @@ def test_track_meta_false_ensure_channel_first(self):
502502 try :
503503 set_track_meta (False )
504504 r = LoadImage (image_only = True , ensure_channel_first = True )(self .test_data )
505- self .assertTupleEqual (r .shape , (1 , 128 , 128 , 128 ))
505+ self .assertTupleEqual (r .shape , (1 , 32 , 32 , 32 ))
506506 self .assertIsInstance (r , torch .Tensor )
507507 self .assertNotIsInstance (r , MetaTensor )
508508 finally :
0 commit comments