Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def dumps():
"""Format config into toml."""
from toml import dumps
return dumps(get())
def to_filename(filename):
"""Write settings to file."""
filename = Path(filename)
filename.write_text(dumps())
# Make sure loggers are started
loggers.init()
def _run_interface(self, runtime):
nii = nb.load(self.inputs.in_file)
zooms = nii.header.get_zooms()
size_diff = np.array(zooms[:3]) - (self.inputs.pixel_size - 0.1)
if np.all(size_diff >= -1e-3):
config.loggers.interface.info("Voxel size is large enough")
self._results["out_file"] = self.inputs.in_file
if isdefined(self.inputs.in_mask):
self._results["out_mask"] = self.inputs.in_mask
return runtime
config.loggers.interface.info(
"One or more voxel dimensions (%f, %f, %f) are smaller than "
"the requested voxel size (%f) - diff=(%f, %f, %f)",
zooms[0],
zooms[1],
zooms[2],
self.inputs.pixel_size,
size_diff[0],
size_diff[1],
size_diff[2],
)