@@ -118,84 +118,6 @@ namespace Nyxus
118118 return true ;
119119 }
120120
121- //
122- // whole-slide 2D case
123- //
124- bool gather_wholeslide_metrics (const std::string& intens_fpath, ImageLoader& L, LR & roi)
125- {
126- PixIntens minI = std::numeric_limits<PixIntens>::max (),
127- maxI = std::numeric_limits<PixIntens>::min ();
128- AABB a;
129-
130- int lvl = 0 , // Pyramid level
131- lyr = 0 ; // Layer
132-
133- // Read the tiff. The image loader is put in the open state in processDataset()
134- size_t nth = L.get_num_tiles_hor (),
135- ntv = L.get_num_tiles_vert (),
136- fw = L.get_tile_width (),
137- th = L.get_tile_height (),
138- tw = L.get_tile_width (),
139- tileSize = L.get_tile_size (),
140- fullwidth = L.get_full_width (),
141- fullheight = L.get_full_height ();
142-
143- int cnt = 1 ;
144- for (unsigned int row = 0 ; row < nth; row++)
145- for (unsigned int col = 0 ; col < ntv; col++)
146- {
147- // Fetch the tile
148- bool ok = L.load_tile (row, col);
149- if (!ok)
150- {
151- std::string erm = " Error fetching tile row:" + std::to_string (row) + " col:" + std::to_string (col) + " from " + intens_fpath;
152- #ifdef WITH_PYTHON_H
153- throw erm;
154- #endif
155- std::cerr << erm << " \n " ;
156- return false ;
157- }
158-
159- // Get ahold of tile's pixel buffer
160- const std::vector<uint32_t >& dataI = L.get_int_tile_buffer ();
161-
162- // Iterate pixels
163- for (size_t i = 0 ; i < tileSize; i++)
164- {
165- int y = row * th + i / tw,
166- x = col * tw + i % tw;
167-
168- // Skip tile buffer pixels beyond the image's bounds
169- if (x >= fullwidth || y >= fullheight)
170- continue ;
171-
172- // Update whole slide's vROI metrics
173- PixIntens I = dataI[i];
174- minI = std::min (minI, I);
175- maxI = std::max (maxI, I);
176- }
177-
178- #ifdef WITH_PYTHON_H
179- if (PyErr_CheckSignals () != 0 )
180- throw pybind11::error_already_set ();
181- #endif
182-
183- // Show progress info
184- VERBOSLVL2 (
185- if (cnt++ % 4 == 0 )
186- std::cout << " \t " << int ((row * nth + col) * 100 / float (nth * ntv) * 100 ) / 100 . << " %\t " << uniqueLabels.size () << " ROIs" << " \n " ;
187- );
188- }
189-
190- // Per-ROI
191- roi.aux_area = fullwidth * fullheight;
192- roi.aux_min = minI;
193- roi.aux_max = maxI;
194- roi.aabb .init_from_widthheight (fullwidth, fullheight);
195-
196- return true ;
197- }
198-
199121 //
200122 // segmented 2.5D case (aka layoutA, collections of 2D slice images e.g. blah_z1_blah.ome.tif, blah_z2_blah.ome.tif, ..., blah_z500_blah.ome.tif)
201123 // prerequisite: 'theImLoader' needs to be pre-opened !
0 commit comments