@@ -16,8 +16,12 @@ def setUp(self):
1616
1717 self .brain_extractor = HDBetExtractor ()
1818 self .input_image_path = input_dir + "/tcia_example_t1c.nii.gz"
19+ self .input_brain_mask_path = input_dir + "/bet_tcia_example_t1c_mask.nii.gz"
1920 self .masked_image_path = self .output_dir + "/bet_tcia_example_t1c.nii.gz"
20- self .brain_mask_path = self .output_dir + "/bet_tcia_example_t1c_masked.nii.gz"
21+ self .brain_mask_path = self .output_dir + "/bet_tcia_example_t1c_mask.nii.gz"
22+ self .masked_again_image_path = (
23+ self .output_dir + "/bet_tcia_example_t1c_masked2.nii.gz"
24+ )
2125
2226 print (self .input_image_path )
2327 print (self .masked_image_path )
@@ -26,6 +30,7 @@ def tearDown(self):
2630 # Clean up created files if they exist
2731 shutil .rmtree (self .output_dir )
2832
33+
2934 def test_extract_creates_output_files (self ):
3035 # we try to run the fastest possible skullstripping on GPU
3136 self .brain_extractor .extract (
@@ -47,11 +52,12 @@ def test_extract_creates_output_files(self):
4752 )
4853
4954 def test_apply_mask_creates_output_file (self ):
50- # self.brain_extractor.apply_mask(
51- # self.input_image, self.mask_image, self.output_image
52- # )
53- # self.assertTrue(
54- # os.path.exists(self.output_image_path),
55- # "Output image file was not created in apply_mask.",
56- # )
57- ...
55+ self .brain_extractor .apply_mask (
56+ input_image_path = self .input_image_path ,
57+ mask_image_path = self .input_brain_mask_path ,
58+ masked_image_path = self .masked_again_image_path ,
59+ )
60+ self .assertTrue (
61+ os .path .exists (self .masked_again_image_path ),
62+ "Output image file was not created in apply_mask." ,
63+ )
0 commit comments