@@ -123,8 +123,8 @@ def create_step(self, url: str) -> api.Step:
123
123
cwl_tool = pp .get_plugin (self ._camel (manifest .name ), plugin_version ).save_cwl (
124
124
self .cwl_path .joinpath (f"{ self ._camel (manifest .name )} .cwl" )
125
125
)
126
- step = api .Step (cwl_tool )
127
- return step
126
+ # step = api.Step(cwl_tool)
127
+ return cwl_tool
128
128
129
129
def manifest_urls (self , x : str ) -> str :
130
130
"""URLs on GitHub for plugin manifests"""
@@ -162,84 +162,107 @@ def workflow(self) -> None:
162
162
"""
163
163
A CWL nuclear segmentation pipeline.
164
164
"""
165
- # BBBCDownload
165
+ # # BBBCDownload
166
166
bbbc = self .create_step (self .manifest_urls ("bbbc_download" ))
167
- bbbc .name = self .name
168
- bbbc .outDir = Path ("bbbc.outDir" )
167
+ # bbbc.name = self.name
168
+ # bbbc.outDir = Path("bbbc.outDir")
169
169
170
- # Renaming plugin
170
+ # # Renaming plugin
171
171
rename = self .create_step (self .manifest_urls ("file_renaming" ))
172
+ # rename.filePattern = self.file_pattern
173
+ # rename.outFilePattern = self.out_file_pattern
174
+ # rename.mapDirectory = self.map_directory
175
+ # rename.inpDir = bbbc.outDir
176
+ # rename.outDir = Path("rename.outDir")
177
+
178
+ self .modify_cwl ()
179
+
180
+
181
+ # # OMEConverter
182
+ # ome_converter = self.create_step(self.manifest_urls("ome_converter"))
183
+ # ome_converter.filePattern = self._string_after_period(self.out_file_pattern)
184
+ # ome_converter.fileExtension = ".ome.tif"
185
+ # ome_converter.inpDir = rename.outDir
186
+ # ome_converter.outDir = Path("ome_converter.outDir")
187
+
188
+ # # Estimate Flatfield
189
+ # estimate_flatfield = self.create_step(self.manifest_urls("estimate_flatfield"))
190
+ # estimate_flatfield.inpDir = ome_converter.outDir
191
+ # estimate_flatfield.filePattern = self.image_pattern
192
+ # estimate_flatfield.groupBy = self.group_by
193
+ # estimate_flatfield.getDarkfield = True
194
+ # estimate_flatfield.outDir = Path("estimate_flatfield.outDir")
195
+
196
+ # # # Apply Flatfield
197
+ # apply_flatfield = self.create_step(self.manifest_urls("apply_flatfield"))
198
+ # apply_flatfield.imgDir = ome_converter.outDir
199
+ # apply_flatfield.imgPattern = self.image_pattern
200
+ # apply_flatfield.ffDir = estimate_flatfield.outDir
201
+ # apply_flatfield.ffPattern = self.ff_pattern
202
+ # apply_flatfield.dfPattern = self.df_pattern
203
+ # apply_flatfield.outDir = Path("apply_flatfield.outDir")
204
+ # apply_flatfield.dataType = True
205
+
206
+ # ## Kaggle Nuclei Segmentation
207
+ # kaggle_nuclei_segmentation = self.create_step(
208
+ # self.manifest_urls("kaggle_nuclei_segmentation")
209
+ # )
210
+ # kaggle_nuclei_segmentation.inpDir = apply_flatfield.outDir
211
+
212
+ # kaggle_nuclei_segmentation.filePattern = self.image_pattern
213
+ # kaggle_nuclei_segmentation.outDir = Path("kaggle_nuclei_segmentation.outDir")
214
+
215
+ # ## FTL Label Plugin
216
+ # ftl_plugin = self.create_step(self.manifest_urls("ftl_plugin"))
217
+ # ftl_plugin.inpDir = kaggle_nuclei_segmentation.outDir
218
+ # ftl_plugin.connectivity = 1
219
+ # ftl_plugin.binarizationThreshold = 0.5
220
+ # ftl_plugin.outDir = Path("ftl_plugin.outDir")
221
+
222
+ # logger.info("Initiating CWL Nuclear Segmentation Workflow!!!")
223
+ # steps = [
224
+ # bbbc,
225
+ # # rename,
226
+ # # ome_converter,
227
+ # # estimate_flatfield,
228
+ # # apply_flatfield,
229
+ # # kaggle_nuclei_segmentation,
230
+ # # ftl_plugin
231
+ # ]
232
+ bbbc = api .Step (clt_path = '/Users/abbasih2/Documents/Job/Axle_Work/image-workflows/cwl_adapters/BbbcDownload.cwl' )
233
+ # We can inline the inputs to each step individually.
234
+ bbbc .name = 'BBBC001'
235
+ bbbc .outDir = Path ('bbbc.outDir' )
236
+
237
+
238
+ rename = api .Step (clt_path = '/Users/abbasih2/Documents/Job/Axle_Work/image-workflows/cwl_adapters/FileRenaming.cwl' )
172
239
rename .filePattern = self .file_pattern
173
240
rename .outFilePattern = self .out_file_pattern
174
241
rename .mapDirectory = self .map_directory
175
242
rename .inpDir = bbbc .outDir
176
243
rename .outDir = Path ("rename.outDir" )
177
244
178
-
179
- # OMEConverter
180
- ome_converter = self .create_step (self .manifest_urls ("ome_converter" ))
181
- ome_converter .filePattern = self ._string_after_period (self .out_file_pattern )
182
- ome_converter .fileExtension = ".ome.tif"
183
- ome_converter .inpDir = rename .outDir
184
- ome_converter .outDir = Path ("ome_converter.outDir" )
185
-
186
- # Estimate Flatfield
187
- estimate_flatfield = self .create_step (self .manifest_urls ("estimate_flatfield" ))
188
- estimate_flatfield .inpDir = ome_converter .outDir
189
- estimate_flatfield .filePattern = self .image_pattern
190
- estimate_flatfield .groupBy = self .group_by
191
- estimate_flatfield .getDarkfield = True
192
- estimate_flatfield .outDir = Path ("estimate_flatfield.outDir" )
193
-
194
- # # Apply Flatfield
195
- apply_flatfield = self .create_step (self .manifest_urls ("apply_flatfield" ))
196
- apply_flatfield .imgDir = ome_converter .outDir
197
- apply_flatfield .imgPattern = self .image_pattern
198
- apply_flatfield .ffDir = estimate_flatfield .outDir
199
- apply_flatfield .ffPattern = self .ff_pattern
200
- apply_flatfield .dfPattern = self .df_pattern
201
- apply_flatfield .outDir = Path ("apply_flatfield.outDir" )
202
- apply_flatfield .dataType = True
203
-
204
- ## Kaggle Nuclei Segmentation
205
- kaggle_nuclei_segmentation = self .create_step (
206
- self .manifest_urls ("kaggle_nuclei_segmentation" )
207
- )
208
- kaggle_nuclei_segmentation .inpDir = apply_flatfield .outDir
209
-
210
- kaggle_nuclei_segmentation .filePattern = self .image_pattern
211
- kaggle_nuclei_segmentation .outDir = Path ("kaggle_nuclei_segmentation.outDir" )
212
-
213
- ## FTL Label Plugin
214
- ftl_plugin = self .create_step (self .manifest_urls ("ftl_plugin" ))
215
- ftl_plugin .inpDir = kaggle_nuclei_segmentation .outDir
216
- ftl_plugin .connectivity = 1
217
- ftl_plugin .binarizationThreshold = 0.5
218
- ftl_plugin .outDir = Path ("ftl_plugin.outDir" )
219
-
220
- logger .info ("Initiating CWL Nuclear Segmentation Workflow!!!" )
221
245
steps = [
222
246
bbbc ,
223
- rename ,
224
- ome_converter ,
225
- estimate_flatfield ,
226
- apply_flatfield ,
227
- kaggle_nuclei_segmentation ,
228
- ftl_plugin
247
+ rename
229
248
]
230
249
231
- workflow = api .Workflow (steps , "experiment" , self .workflow_path )
250
+ workflow = api .Workflow ([], "experiment" )
251
+ for step in steps :
252
+ workflow .append (step )
232
253
# # Saving CLT for plugins
233
- workflow ._save_all_cwl (overwrite = True )
234
- # # Adding environmental variables for bbbc_download and ome_converter plugin
235
- self .modify_cwl ()
236
- # # # Save yaml to run CWL tool
237
- workflow ._save_yaml ()
238
- # Compile and run using WIC python API
239
- workflow .compile (run_local = True , overwrite = False )
240
- # # print(workflow.yml_path)
241
- # # clean autognerated directories
242
- self ._clean ()
243
- self ._move_outputs ()
244
- logger .info ("Completed CWL nuclear segmentation workflow." )
254
+ # workflow._save_all_cwl()
255
+ # # # Adding environmental variables for bbbc_download and ome_converter plugin
256
+ # self.modify_cwl()
257
+
258
+ # # # # Save yaml to run CWL tool
259
+ workflow .write_ast_to_disk (directory = Path ('/Users/abbasih2/Documents/Job/Axle_Work/image-workflows/outputs' ))
260
+ # workflow.compile(write_to_disk=True)
261
+ # # Compile and run using WIC python API
262
+ # workflow.compile(run_local=True, overwrite=False)
263
+ workflow .run ()
264
+ # # # clean autognerated directories
265
+ # self._clean()
266
+ # self._move_outputs()
267
+ # logger.info("Completed CWL nuclear segmentation workflow.")
245
268
return
0 commit comments