예제 #1
0
 def test_do_calculation_calculation_process(self, tmpdir, data_test_dir):
     plan = self.create_calculation_plan3()
     file_path = os.path.join(data_test_dir, "stack1_components",
                              "stack1_component1.tif")
     calc = Calculation(
         [file_path],
         base_prefix=data_test_dir,
         result_prefix=data_test_dir,
         measurement_file_path=os.path.join(tmpdir, "test3.xlsx"),
         sheet_name="Sheet1",
         calculation_plan=plan,
         voxel_size=(1, 1, 1),
     )
     calc_process = CalculationProcess()
     res = calc_process.do_calculation(FileCalculation(file_path, calc))
     assert isinstance(res, list)
     assert isinstance(res[0], ResponseData)
예제 #2
0
 def test_do_calculation_save(self, tmpdir, data_test_dir, file_name,
                              root_type, save_method: SaveBase):
     save_desc = Save("_test", "", save_method.get_name(),
                      save_method.get_short_name(),
                      save_method.get_default_values())
     plan = self.create_simple_plan(root_type, save_desc)
     file_path = os.path.join(data_test_dir, file_name)
     calc = Calculation(
         [file_path],
         base_prefix=os.path.dirname(file_path),
         result_prefix=tmpdir,
         measurement_file_path=os.path.join(tmpdir, "test3.xlsx"),
         sheet_name="Sheet1",
         calculation_plan=plan,
         voxel_size=(1, 1, 1),
     )
     calc_process = CalculationProcess()
     res = calc_process.do_calculation(FileCalculation(file_path, calc))
     assert isinstance(res, list)
     assert isinstance(res[0], ResponseData)
예제 #3
0
 def test_full_pipeline_base(self, tmpdir, data_test_dir, monkeypatch):
     monkeypatch.setattr(batch_backend, "CalculationProcess",
                         MockCalculationProcess)
     plan = self.create_calculation_plan()
     file_pattern = os.path.join(data_test_dir, "stack1_components",
                                 "stack1_component*[0-9].tif")
     file_paths = sorted(glob(file_pattern))
     assert os.path.basename(file_paths[0]) == "stack1_component1.tif"
     calc = Calculation(
         file_paths,
         base_prefix=data_test_dir,
         result_prefix=data_test_dir,
         measurement_file_path=os.path.join(tmpdir, "test.xlsx"),
         sheet_name="Sheet1",
         calculation_plan=plan,
         voxel_size=(1, 1, 1),
     )
     calc_process = CalculationProcess()
     for file_path in file_paths:
         res = calc_process.do_calculation(FileCalculation(file_path, calc))
         assert isinstance(res, list)
         assert isinstance(res[0], ResponseData)