rg314/pytraction

Example data for multiple image stacks

Opened this issue · 1 comments

I tried using a Path object from pathlib to automate a folder analysis, and it seems that load_data() doesn't work with Path objects (at least on Windows). Code:

pix_per_um = 1.0 / 0.1018971 
E = 3000 

p = Path('../data/')

dir = p / 'cells' / '1kPa'
refs = set(dir .glob('*_ref.tif'))
imgs = set(dir .glob('*.tif')) - refs
dataset = list(zip(sorted(imgs), sorted(refs)))

traction_obj = TractionForce(pix_per_um, E=E)

for img_path, ref_path in dataset:
    img, ref, _ = traction_obj.load_data(img_path, ref_path)

Raises:
RuntimeWarning: Please ensure that the input image has shape (f,c,w,h) the current shape is (1088, 1590)

This is (at least temporarily) solved by changing the last line to:
img, ref, _ = traction_obj.load_data(str(img_path), str(ref_path))

rg314 commented

Hi Andrea, I've updated the naming of this issue to demonstrate an example usage of multiple image stacks.