231 {
232 List<ROI> rois = new List<ROI>();
233 string st = File.ReadAllText(filePath);
234 GeoJsonFeatureCollection gs = JsonConvert.DeserializeObject<GeoJsonFeatureCollection>(st);
235
236 foreach (GeoJsonFeature f in gs.features)
237 {
238 ROI r = new ROI();
239 if (f.geometry.type == "Polygon")
240 {
241 r.type = ROI.Type.Polygon;
242 r.closed = true;
244 if (f.geometry.plane != null)
245 r.coord = f.geometry.GetZCT();
246 }
247 else if (f.geometry.type == "LineString")
248 {
249 r.type = ROI.Type.Line;
251 if (r.Points.Count > 2)
252 r.type = ROI.Type.Polyline;
253 if (f.geometry.plane != null)
254 r.coord = f.geometry.GetZCT();
255 }
256 else
257 {
258 r.type = ROI.Type.Point;
260 if (f.geometry.plane != null)
261 r.coord = f.geometry.GetZCT();
262 }
263 rois.Add(r);
264 }
265 Recorder.Record($"QuPath.ReadROI(\"{filePath}\", {b});");
266 return rois.ToArray();
267 }
static PointD[] GetPoints(GeoJsonGeometry p, BioImage b)
Definition QuPath.cs:74