|
92 | 92 | "# If necessary, manually change the bboxes size by changing w and h:\n", |
93 | 93 | "boundaries = slice_img.increase_bbox(coords, w=190, h=40, shape=img.shape)\n", |
94 | 94 | "\n", |
95 | | - "rect_coords = [slice_img.boundary_to_rect_coords(b) for b in boundaries]\n", |
| 95 | + "rect_coords = [slice_img.boundary_to_rect_coords(b) for b in boundaries.values()]\n", |
96 | 96 | "recs = [Rectangle((y, x), w, h) for (x, y, w, h) in rect_coords]\n", |
97 | 97 | "\n", |
98 | | - "centroids = [((x0 + x1) // 2, (y0 + y1) // 2) for (x0, x1, y0, y1) in coords]\n", |
| 98 | + "centroids = [((x0 + x1) // 2, (y0 + y1) // 2) for (x0, x1, y0, y1) in coords.values()]\n", |
99 | 99 | "h = img.shape[0]\n", |
100 | 100 | "w = img.shape[1]\n", |
101 | 101 | "\n", |
|
105 | 105 | "ax.set_axis_off()\n", |
106 | 106 | "ax.imshow(img)\n", |
107 | 107 | "\n", |
108 | | - "for i, (y, x) in enumerate(centroids):\n", |
109 | | - " ax.text(x, y, str(i + 1))\n", |
| 108 | + "for i, (x0, x1, y0, y1) in boundaries.items():\n", |
| 109 | + " centroid_x = (x0 + x1) // 2\n", |
| 110 | + " centroid_y = (y0 + y1) // 2\n", |
| 111 | + " ax.text(centroid_y, centroid_x, str(i))\n", |
110 | 112 | "\n", |
111 | 113 | "pc = PatchCollection(recs, color=\"red\", alpha=0.7, linewidth=1, facecolor=\"none\")\n", |
112 | 114 | "ax.add_collection(pc)\n", |
|
138 | 140 | "# Delete the individual movies created after the end of the analysis\n", |
139 | 141 | "clean_up_data = False\n", |
140 | 142 | "# List of the ids of the embryos that should be processed\n", |
141 | | - "embryos = list(range(1, 15))\n", |
| 143 | + "embryos = list(range(1, 4))\n", |
142 | 144 | "# Interval used to calculate VNC length\n", |
143 | 145 | "vnc_length_interval = 10\n", |
144 | 146 | "# Window to calculate VNC ROI (which is then used to calculate activity)\n", |
|
154 | 156 | "\n", |
155 | 157 | "# tif to individual movies\n", |
156 | 158 | "print(\"Cropping individual movies\")\n", |
157 | | - "slice_img.cut_movies(coords, img_path, embs_dest, embryos=embryos, overwrite=False)\n", |
| 159 | + "slice_img.cut_movies(boundaries, img_path, embs_dest, embryos=embryos, overwrite=False)\n", |
158 | 160 | "\n", |
159 | 161 | "# movies to length\n", |
160 | 162 | "print(\"Calculating VNC lengths\")\n", |
|
0 commit comments