22import os
33from typing import Union
44
5- import nibabel as nib
65import numpy as np
76import pandas as pd
87from joblib import Parallel , cpu_count , delayed
9- from PIL import Image
108
119import brainbuilder .utils .utils as utils
1210from brainbuilder .utils .mesh_io import load_mesh_ext
1311from brainbuilder .utils .utils import get_logger
12+ import nibabel as nib
13+ from PIL import Image
1414
1515global chunk_info_required_columns
1616global sect_info_required_columns
@@ -82,9 +82,9 @@ def val_func(x: Union[int, float, str]) -> bool:
8282sub = Column ("sub" , None )
8383hemisphere = Column ("hemisphere" , None )
8484chunk = Column ("chunk" , None )
85- # direction = Column("direction", None) #DEPRECIATED
86- # pixel_size_0 = Column("pixel_size_0", float) #DEPRECIATED
87- # pixel_size_1 = Column("pixel_size_1", float) #DEPRECIATED
85+ #direction = Column("direction", None) #DEPRECIATED
86+ #pixel_size_0 = Column("pixel_size_0", float) #DEPRECIATED
87+ #pixel_size_1 = Column("pixel_size_1", float) #DEPRECIATED
8888section_thickness = Column ("section_thickness" , float )
8989acquisition = Column ("acquisition" , None )
9090sample = Column ("sample" , int )
@@ -94,13 +94,12 @@ def val_func(x: Union[int, float, str]) -> bool:
9494struct_ref_vol = Column ("struct_ref_vol" , "volume" )
9595
9696# Surfaces
97- # gm_surf = Column("gm_surf", "surface", False) #DEPRECIATED
98- # wm_surf = Column("wm_surf", "surface", False) #DEPRECIATED
97+ #gm_surf = Column("gm_surf", "surface", False) #DEPRECIATED
98+ #wm_surf = Column("wm_surf", "surface", False) #DEPRECIATED
9999
100-
101- chunk_info_required_columns = [sub , hemisphere , chunk , section_thickness ]
102- sect_info_required_columns = [acquisition , sub , hemisphere , chunk , raw , sample ]
103- hemi_info_required_columns = [sub , hemisphere , struct_ref_vol ]
100+ chunk_info_required_columns = [sub , hemisphere , chunk , section_thickness ]
101+ sect_info_required_columns = [acquisition , sub , hemisphere , chunk , raw , sample ]
102+ hemi_info_required_columns = [sub , hemisphere , struct_ref_vol ]
104103
105104
106105def validate_dataframe (
@@ -212,7 +211,6 @@ def _can_open_volume(path: str) -> bool:
212211 logger .critical (last_exc )
213212 return False
214213
215-
216214def validate_volume (fn : str , check_not_empty : bool = False ) -> bool :
217215 """Validate that a volume exists and that it is not empty.
218216
@@ -227,13 +225,13 @@ def validate_volume(fn: str, check_not_empty: bool = False) -> bool:
227225 valid_inputs = False
228226 else :
229227 try :
230- if check_not_empty :
228+ if check_not_empty :
231229 vol = utils .load_image (fn )
232230
233231 if np .sum (np .abs (vol )) == 0 :
234232 valid_inputs = False
235233 logger .info (f"\t Missing input: empty template file { fn } " )
236- else :
234+ else :
237235 valid_inputs = _can_open_volume (fn )
238236
239237 except Exception as e :
0 commit comments