georgeoshardo / SyMBac

Accurate segmentation of bacterial microscope images using deep learning synthetically generated image data.
https://doi.org/10.1186/s12915-022-01453-6
GNU General Public License v2.0
18 stars 9 forks source link

Smaller Cell length and width Error of ValueError: too many values to unpack (expected 2) #21

Open DustinBaek opened 2 years ago

DustinBaek commented 2 years ago

Hi i'm trying to generate fluorescent synthetic images for 40x resolution.

For real image I loaded the real fluorescent image as a reference. (It's blue_mem_1.tif in zip file) blue_mem_1.zip

For scope properties, I modified it accordingly: image

Then for run simulation, I changed cell_max_length and cell_width to 1.65 and 0.95 for short cells image

Then I run into error below:

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
C:\Users\DUSTIN~1\AppData\Local\Temp/ipykernel_716/4041415164.py in <module>
      1 sim_length = 10
----> 2 cell_timeseries, space = run_simulation(
      3     trench_length=15,
      4     trench_width=1.5,
      5     cell_max_length=1.65,

~\Desktop\Dissertation\SyMBac\examples\../../SyMBac\SyMBac\phase_contrast_drawing.py in run_simulation(trench_length, trench_width, cell_max_length, cell_width, sim_length, pix_mic_conv, gravity, phys_iters, max_length_var, width_var, save_dir)
    216     cells = [cell1]
    217     pyglet.clock.schedule_interval(step_and_update, interval=dt, cells=cells, space=space, phys_iters=phys_iters ,ylim=trench_length, cell_timeseries = cell_timeseries,x=x,sim_length=sim_length, save_dir=save_dir)
--> 218     pyglet.app.run()
    219     #window.close()
    220     #phys_iters = phys_iters

~\.conda\envs\symbac\lib\site-packages\pyglet\app\__init__.py in run()
    105 
    106     """
--> 107     event_loop.run()
    108 
    109 

~\.conda\envs\symbac\lib\site-packages\pyglet\app\base.py in run(self)
    167 
    168         while not self.has_exit:
--> 169             timeout = self.idle()
    170             platform_event_loop.step(timeout)
    171 

~\.conda\envs\symbac\lib\site-packages\pyglet\app\base.py in idle(self)
    237         """
    238         dt = self.clock.update_time()
--> 239         redraw_all = self.clock.call_scheduled_functions(dt)
    240 
    241         # Redraw all windows

~\.conda\envs\symbac\lib\site-packages\pyglet\clock.py in call_scheduled_functions(self, dt)
    290 
    291             # execute the callback
--> 292             item.func(now - item.last_ts, *item.args, **item.kwargs)
    293 
    294             if item.interval:

~\Desktop\Dissertation\SyMBac\examples\../../SyMBac\SyMBac\scene_functions.py in step_and_update(dt, cells, space, phys_iters, ylim, cell_timeseries, x, sim_length, save_dir)
     57 
     58     update_cell_lengths(cells)
---> 59     update_pm_cells(cells)
     60 
     61     for _ in range(phys_iters):

~\Desktop\Dissertation\SyMBac\examples\../../SyMBac\SyMBac\scene_functions.py in update_pm_cells(cells)
     24             daughter_details = cell.create_pm_cell()
     25             if len(daughter_details) > 2: # Really hacky. Needs fixing because sometimes this returns cell_body, cell shape. So this is a check to ensure that it's returing daughter_x, y and angle
---> 26                 daughter = Cell(**daughter_details)
     27                 cells.append(daughter)
     28         else:

~\Desktop\Dissertation\SyMBac\examples\../../SyMBac\SyMBac\cell.py in __init__(self, length, width, resolution, position, angle, space, dt, growth_rate_constant, max_length, max_length_mean, max_length_var, width_var, width_mean)
    110         self.max_length_mean = max_length_mean
    111         self.max_length_var = max_length_var
--> 112         self.body, self.shape = self.create_pm_cell()
    113         self.angle = self.body.angle
    114         self.ID = np.random.randint(0,100_000_000)

ValueError: too many values to unpack (expected 2)

It seems to me that when we decrease cell_max_length to certain extent(like 2) this happens...