Skip to content

Commit

Permalink
Fix bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
kostrykin committed Sep 12, 2024
1 parent 23b175d commit 2ce9b59
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions superdsm/c2freganal.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ class C2F_RegionAnalysis(repype.stage.Stage):
inputs = ['y', 'dsm_cfg']
outputs = ['y_mask', 'atoms', 'adjacencies', 'seeds', 'clusters']

def process(y, dsm_cfg, pipeline, config, status=None):
def process(self, y, dsm_cfg, pipeline, config, status=None):
seed_connectivity = config.get('seed_connectivity', 8)
min_atom_radius = config.get('min_atom_radius', 15)
max_atom_norm_energy = config.get('max_atom_norm_energy', 0.05)
Expand Down Expand Up @@ -187,7 +187,7 @@ def process(y, dsm_cfg, pipeline, config, status=None):
'clusters': clusters
}

def configure(pipeline, input_id, *args, radius, **kwargs):
def configure(self, pipeline, input_id, *args, radius, **kwargs):
return {
'min_atom_radius': (radius, 0.33, dict(type=int)),
}
Expand Down
4 changes: 2 additions & 2 deletions superdsm/dsmcfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,15 @@ class DSM_Config(repype.stage.Stage):
id = 'dsm'
outputs = ['dsm_cfg']

def process(pipeline, config, status=None):
def process(self, pipeline, config, status=None):
dsm_cfg = {
key: config.get(key, DSM_CONFIG_DEFAULTS[key]) for key in DSM_CONFIG_DEFAULTS.keys()
}
return {
'dsm_cfg': dsm_cfg
}

def configure(pipeline, input_id, *args, scale, **kwargs):
def configure(self, pipeline, input_id, *args, scale, **kwargs):
return {
'alpha': (scale ** 2, 0.0005),
'smooth_amount': (scale, 0.2, dict(type=int, min=4)),
Expand Down
4 changes: 2 additions & 2 deletions superdsm/globalenergymin.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ class GlobalEnergyMinimization(repype.stage.Stage):
inputs = ['y', 'y_mask', 'atoms', 'adjacencies', 'dsm_cfg']
outputs = ['y_img', 'cover', 'objects', 'performance']

def process(y, y_mask, atoms, adjacencies, dsm_cfg, pipeline, config, status=None, log_root_dir=None):
def process(self, y, y_mask, atoms, adjacencies, dsm_cfg, pipeline, config, status=None, log_root_dir=None):
y_img = Image.create_from_array(y, normalize=False, mask=y_mask)
pruning = config.get( 'pruning', 'exact')
beta = config.get( 'beta', 0)
Expand Down Expand Up @@ -177,7 +177,7 @@ def process(y, y_mask, atoms, adjacencies, dsm_cfg, pipeline, config, status=Non
'performance': performance,
}

def configure(pipeline, input_id, *args, scale, diameter, **kwargs):
def configure(self, pipeline, input_id, *args, scale, diameter, **kwargs):
return {
'beta': (scale ** 2, 0.66),
'max_seed_distance': (diameter, np.inf),
Expand Down
2 changes: 1 addition & 1 deletion superdsm/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class LoadInput(repype.stage.Stage):
inputs = ['input_id']
outputs = ['g_raw']

def process(input_id: InputID, pipeline: Pipeline, config: repype.config.Config, status: Optional[repype.status.Status] = None) -> Dict[str, Any]:
def process(self, input_id: InputID, pipeline: Pipeline, config: repype.config.Config, status: Optional[repype.status.Status] = None) -> Dict[str, Any]:
img_filepath = pipeline.resolve('input', input_id)
return dict(
g_raw = superdsm.io.imread(img_filepath)
Expand Down
4 changes: 2 additions & 2 deletions superdsm/postprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ class Postprocessing(repype.stage.Stage):
inputs = ['cover', 'y_img', 'atoms', 'g_raw', 'dsm_cfg']
outputs = ['postprocessed_objects']

def process(cover, y_img, atoms, g_raw, dsm_cfg, pipeline, config, status=None, log_root_dir=None):
def process(self, cover, y_img, atoms, g_raw, dsm_cfg, pipeline, config, status=None, log_root_dir=None):
# simple post-processing
max_norm_energy = config.get( 'max_norm_energy', 0.2)
discard_image_boundary = config.get( 'discard_image_boundary', False)
Expand Down Expand Up @@ -238,7 +238,7 @@ def process(cover, y_img, atoms, g_raw, dsm_cfg, pipeline, config, status=None,
'postprocessed_objects': postprocessed_objects
}

def configure(pipeline, input_id, *args, radius, **kwargs):
def configure(self, pipeline, input_id, *args, radius, **kwargs):
return {
'min_object_radius': (radius, 0.0),
'max_object_radius': (radius, np.inf),
Expand Down
4 changes: 2 additions & 2 deletions superdsm/preprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class Preprocessing(repype.stage.Stage):
inputs = ['g_raw']
outputs = ['y']

def process(g_raw, pipeline, config, status=None):
def process(self, g_raw, pipeline, config, status=None):
sigma1 = config.get('sigma1', math.sqrt(2))
sigma2 = config.get('sigma2', 40)
offset_clip = config.get('offset_clip', 3)
Expand Down Expand Up @@ -61,7 +61,7 @@ def process(g_raw, pipeline, config, status=None):
'y': y,
}

def configure(pipeline, input_id, *args, scale, **kwargs):
def configure(self, pipeline, input_id, *args, scale, **kwargs):
return {
'sigma2': (scale, 1.0),
}
Expand Down

0 comments on commit 2ce9b59

Please sign in to comment.