@@ -87,6 +87,8 @@ def remove_outputs(self, **kwargs):
8787pbpt_gen_cmds_cls_slurm_sing_tmplt = """
8888import logging
8989import os
90+ import glob
91+ import rsgislib.tools.filetools
9092
9193from pbprocesstools.pbpt_q_process import PBPTGenQProcessToolCmds
9294
@@ -100,20 +102,33 @@ def gen_command_info(self, **kwargs):
100102 if not os.path.exists(kwargs["out_dir"]):
101103 os.mkdir(kwargs["out_dir"])
102104
103- # You will probably have a loop here:
104- # Within the loop create a dict with the parameters for each
105- # job which will be added to the self.params list.
106- c_dict = dict()
107- c_dict["input1"] = ""
108- c_dict["input2"] = ""
109- c_dict["input3"] = ""
110- c_dict["output1"] = ""
111- self.params.append(c_dict)
105+ # Get the list of input images
106+ ref_imgs = glob.glob(kwargs["ref_imgs"])
107+
108+ # Loop through the reference images to create the jobs
109+ for ref_img in ref_imgs:
110+ # Get the basename of the input file to make the output file name
111+ basename = rsgislib.tools.filetools.get_file_basename(ref_img)
112+
113+ # Create the output file name
114+ output_file = os.path.join(kwargs["out_dir"], f"{basename}.tif")
115+ # Check if the output file exists.
116+ if not os.path.exists(output_file):
117+ # You will probably have a loop here:
118+ # Within the loop create a dict with the parameters for each
119+ # job which will be added to the self.params list.
120+ c_dict = dict()
121+ c_dict["input1"] = ""
122+ c_dict["input2"] = ""
123+ c_dict["input3"] = ""
124+ c_dict["output1"] = ""
125+ self.params.append(c_dict)
112126
113127 def run_gen_commands(self):
114128 # Could Pass info to gen_command_info function
115129 # (e.g., input / output directories)
116- self.gen_command_info(out_dir="/path/to/outputs")
130+ self.gen_command_info(ref_imgs="path/to/inputs/*.kea",
131+ out_dir="/path/to/outputs")
117132
118133 self.pop_params_db()
119134
0 commit comments