volume, header = load_dicom_volume_as_numpy_from_list(get_series_for_inference(study_dir)) print(f"Found series of {volume.shape[2]} axial slices") print("HippoVolume.AI: Running inference...") # Use the UNetInferenceAgent class and model parameter file from the previous section inference_agent = UNetInferenceAgent( device="cpu", parameter_file_path=r"../../section2/out/model.pth") # Run inference # single_volume_inference_unpadded takes a volume of arbitrary size # and reshapes y and z dimensions to the patch size used by the model before # running inference. Your job is to implement it. t_start = time.time() pred_label = inference_agent.single_volume_inference_unpadded(np.array(volume)) pred_volumes = get_predicted_volumes(pred_label) # Create and save the report print("Creating and pushing report...") report_save_path = r"../out/report.dcm" # STAND OUT SUGGESTION: save_report_as_dcm has some suggestions if you want to expand your # knowledge of DICOM format report_img = create_report(pred_volumes, header, volume, pred_label) save_report_as_dcm(header, report_img, report_save_path) t_end = time.time() print(f"Process time: {t_end-t_start}") # Send report to our storage archive # Write a command line string that will issue a DICOM C-STORE request to send our report
# TASK_COMPLETE : get_series_for_inference is not comete. Go and complete it # study_dir = [dir for dir, subdirs, files in os.walk(path) if '13_HCropVolume' in dir] volume, header = load_dicom_volume_as_numpy_from_list(get_series_for_inference(study_dir)) print(f"Found series of {volume.shape[2]} axial slices") print("HippoVome.AI: Running inference...") # TASK_COMPLETE : Use the UNetInferenceAgent class and model paramet file from the previous section inference_agent = UNetInferenceAgent( device="cpu", parameter_file_path=r"") # Run inference # TASK_COMPLETE : single_volume_inference_unpadded takes a volume of arbitrary size # and reshapes y and z dimensionto the patch size used by the model before # nning inference. Your job is to implement it. pred_label = inference_agent.single_volume_inference_unpadded(np.array(volume), patch_size=64) # TASK_COMPLETE : get_pricted_volumes is not complete. Go and complete it pred_volumes = get_predicted_volumes(pred_label) # Create and savehe report print("Creating and pushing report...") report_save_path = r"../out/report.dcm" # TASK_COMPLETE : create_report is not complete. Go and complete it. # STAND OUT SUGGESTION: savreport_as_dcm has some suggestns if you want to expand your # knowledge of DICOM format report_img = create_report(pred_volumes, header, volume, pred_label) save_report_as_dcm(header, report_img, report_save_path) # Send report to our storage archive # TASK_COMPLETE : Write a comma line string that will issue a DICOM C-STORE request to send our report # to our Orthanserver (that runs on port 4242 of the local machine), usinstorescu tool