rg314 / pytraction

Bayesian Traction Force Microscopy
BSD 3-Clause "New" or "Revised" License
3 stars 1 forks source link

Example data for multiple image stacks #32

Open a19s opened 3 years ago

a19s commented 3 years ago

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 3 years ago

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