Skip to content

Commit

Permalink
fix: stat map/info arg to kwarg
Browse files Browse the repository at this point in the history
  • Loading branch information
xgui3783 committed Aug 26, 2024
1 parent d8084e4 commit e90fe97
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions api/server/volumes/parcellationmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def get_parcellation_labelled_map(parcellation_id: str, space_id: str, region_id
""")
@version(*FASTAPI_VERSION)
@router_decorator(ROLE, func=statistical_map_nii_gz)
def get_region_statistical_map(parcellation_id: str, space_id: str, region_id: str, extra_spec: str="", *, func):
def get_region_statistical_map(parcellation_id: str, region_id: str, space_id: str, extra_spec: str="", *, func):
"""Get statistical map according to specification"""
if func is None:
raise HTTPException(500, f"func: None passsed")
Expand All @@ -94,7 +94,7 @@ def get_region_statistical_map(parcellation_id: str, space_id: str, region_id: s
"content-disposition": f'attachment; filename="statistical_map.nii.gz"'
}

full_filename, cache_flag = func(parcellation_id, region_id, space_id, extra_spec)
full_filename, cache_flag = func(parcellation_id=parcellation_id, region_id=region_id, space_id=space_id, extra_spec=extra_spec)
if cache_flag:
headers[cache_header] = "hit"
assert os.path.isfile(full_filename), f"file saved incorrectly"
Expand All @@ -107,12 +107,12 @@ class StatisticModelInfo(BaseModel):
@router.get("/statistical_map.info.json", response_model=StatisticModelInfo, tags=TAGS)
@version(*FASTAPI_VERSION)
@router_decorator(ROLE, func=statistical_map_info_json)
def get_region_statistical_map_metadata(parcellation_id: str, space_id: str, region_id: str, extra_spec: str="", *, func):
def get_region_statistical_map_metadata(parcellation_id: str, region_id: str, space_id: str, extra_spec: str="", *, func):
"""Get metadata of statistical map according to specification"""
if func is None:
raise HTTPException(500, f"func: None passsed")

data = func(parcellation_id, region_id, space_id, extra_spec)
data = func(parcellation_id=parcellation_id, region_id=region_id, space_id=space_id, extra_spec=extra_spec)
return StatisticModelInfo(**data)

@router.get("/assign", response_model=DataFrameModel, tags=TAGS)
Expand Down
4 changes: 2 additions & 2 deletions new_api/v3/data_handlers/map/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@ def get_map(parcellation_id: str, space_id: str, maptype: Union[MapType, str], e
return instance_to_model(returned_maps[0], detail=True).dict()

@data_decorator(ROLE)
def statistical_map_nii_gz(parcellation_id: str, space_id: str, region_id: str, extra_spec: str="", *, no_cache: bool=False):
def statistical_map_nii_gz(parcellation_id: str, region_id: str, space_id: str, extra_spec: str="", *, no_cache: bool=False):
filename, return_cached, warningtext = cache_region_statistic_map(parcellation_id, region_id, space_id, extra_spec, no_cache=no_cache)
return filename, return_cached

@data_decorator(ROLE)
def statistical_map_info_json(parcellation_id: str, space_id: str, region_id: str, extra_spec: str="", *, no_cache: bool=False):
def statistical_map_info_json(parcellation_id: str, region_id: str, space_id: str, extra_spec: str="", *, no_cache: bool=False):
filename, return_cached, warningtext = cache_region_statistic_map(parcellation_id, region_id, space_id, extra_spec, no_cache=no_cache)

import nibabel as nib
Expand Down

0 comments on commit e90fe97

Please sign in to comment.