|
6 | 6 | from magicgui import magicgui |
7 | 7 | from magicgui.widgets import Container |
8 | 8 | from magicgui.widgets import Slider |
9 | | - |
10 | 9 | # Qt |
11 | 10 | from qtpy.QtWidgets import QLabel |
12 | 11 | from qtpy.QtWidgets import QSizePolicy |
@@ -73,6 +72,20 @@ def __init__(self, viewer: "napari.viewer.Viewer", parent): |
73 | 72 |
|
74 | 73 | self.build() |
75 | 74 |
|
| 75 | + ########################################### |
| 76 | + if utils.ENABLE_TEST_MODE(): |
| 77 | + # TODO : remove/disable once done |
| 78 | + if self.as_folder: |
| 79 | + self.image_path = "C:/Users/Cyril/Desktop/Proj_bachelor/data/visual_png/sample" |
| 80 | + if self.crop_label_choice.isChecked(): |
| 81 | + self.label_path = "C:/Users/Cyril/Desktop/Proj_bachelor/data/visual_png/sample_labels" |
| 82 | + else: |
| 83 | + self.image_path = "C:/Users/Cyril/Desktop/Proj_bachelor/data/visual_tif/volumes/images.tif" |
| 84 | + if self.crop_label_choice.isChecked(): |
| 85 | + self.label_path = "C:/Users/Cyril/Desktop/Proj_bachelor/data/visual_tif/labels/testing_im.tif" |
| 86 | + |
| 87 | + ########################################### |
| 88 | + |
76 | 89 | def toggle_label_path(self): |
77 | 90 | if self.crop_label_choice.isChecked(): |
78 | 91 | self.lbl_label.setVisible(True) |
@@ -141,16 +154,20 @@ def quicksave(self): |
141 | 154 | if not self.as_folder: |
142 | 155 | if self.image is not None: |
143 | 156 | im_filename = os.path.basename(self.image_path).split(".")[0] |
| 157 | + print(im_filename) |
144 | 158 | im_dir = os.path.split(self.image_path)[0] + "/cropped" |
| 159 | + print(im_dir) |
145 | 160 | os.makedirs(im_dir, exist_ok=True) |
146 | 161 | viewer.layers["cropped"].save( |
147 | 162 | im_dir + "/" + im_filename + "_cropped_" + time + ".tif" |
148 | 163 | ) |
149 | 164 |
|
150 | | - print(self.label) |
| 165 | + # print(self.label) |
151 | 166 | if self.label is not None: |
152 | 167 | im_filename = os.path.basename(self.label_path).split(".")[0] |
| 168 | + print(im_filename) |
153 | 169 | im_dir = os.path.split(self.label_path)[0] + "/cropped" |
| 170 | + print(im_dir) |
154 | 171 | name = ( |
155 | 172 | im_dir |
156 | 173 | + "/" |
@@ -202,20 +219,6 @@ def start(self): |
202 | 219 | self.filetype = self.filetype_choice.currentText() |
203 | 220 | self.crop_labels = self.crop_label_choice.isChecked() |
204 | 221 |
|
205 | | - ########################################### |
206 | | - if utils.ENABLE_TEST_MODE(): |
207 | | - # TODO : remove/disable once done |
208 | | - if self.as_folder: |
209 | | - self.image_path = "C:/Users/Cyril/Desktop/Proj_bachelor/data/visual_png/sample" |
210 | | - if self.crop_labels: |
211 | | - self.label_path = "C:/Users/Cyril/Desktop/Proj_bachelor/data/visual_png/sample_labels" |
212 | | - else: |
213 | | - self.image_path = "C:/Users/Cyril/Desktop/Proj_bachelor/data/visual_tif/volumes/images.tif" |
214 | | - if self.crop_labels: |
215 | | - self.label_path = "C:/Users/Cyril/Desktop/Proj_bachelor/data/visual_tif/labels/testing_im.tif" |
216 | | - |
217 | | - ########################################### |
218 | | - |
219 | 222 | if not self.check_ready(): |
220 | 223 | return |
221 | 224 |
|
|
0 commit comments