BioLib  3.6.2
A GUI-less version of Bio .NET library for editing & annotating various microscopy image formats.
Loading...
Searching...
No Matches
BioLib.QuPath.Project Class Reference

Static Public Member Functions

static Project FromImages (List< BioImage[]> bms, string QuPathProjectFile)
 
static void SaveProject (string file, List< BioImage[]> bms)
 

Properties

string Version [get, set]
 
long CreateTimestamp [get, set]
 
long ModifyTimestamp [get, set]
 
string Uri [get, set]
 
int LastID [get, set]
 
List< ImageImages [get, set]
 

Detailed Description

Definition at line 280 of file QuPath.cs.

Member Function Documentation

◆ FromImages()

static Project BioLib.QuPath.Project.FromImages ( List< BioImage[]> bms,
string QuPathProjectFile )
static

Definition at line 288 of file QuPath.cs.

289 {
290 QuPath.Project proj = new QuPath.Project();
291 proj.Version = "0.6.0";
292 proj.Uri = "file:/" + QuPathProjectFile.Replace("\\","/");
293 DateTime dateTime = DateTime.Now;
294 long timestampMillis = new DateTimeOffset(dateTime).ToUnixTimeMilliseconds();
295 proj.CreateTimestamp = timestampMillis;
296 proj.ModifyTimestamp = timestampMillis;
297 proj.Images = new List<Image>();
298 int id = 0;
299 foreach (var item in bms)
300 {
301 foreach (var b in item)
302 {
303 List<Image> im = Image.FromBioImages(item.ToList(), id);
304 proj.Images.AddRange(im);
305 id++;
306 }
307 }
308 proj.LastID = id;
309 return proj;
310 }

◆ SaveProject()

static void BioLib.QuPath.Project.SaveProject ( string file,
List< BioImage[]> bms )
static

Definition at line 311 of file QuPath.cs.

312 {
313 Project pr = Project.FromImages(bms, file);
314 Formatting form = new Formatting();
315 var settings = new JsonSerializerSettings
316 {
317 ContractResolver = new CamelCasePropertyNamesContractResolver(), // Enable camelCase
318 Formatting = Formatting.Indented // Optional: pretty print
319 };
320 string json = JsonConvert.SerializeObject(pr, settings);
321 File.WriteAllText(file, json);
322 }

Property Documentation

◆ CreateTimestamp

long BioLib.QuPath.Project.CreateTimestamp
getset

Definition at line 283 of file QuPath.cs.

283{ get; set; }

◆ Images

List<Image> BioLib.QuPath.Project.Images
getset

Definition at line 287 of file QuPath.cs.

287{ get; set; }

◆ LastID

int BioLib.QuPath.Project.LastID
getset

Definition at line 286 of file QuPath.cs.

286{ get; set; }

◆ ModifyTimestamp

long BioLib.QuPath.Project.ModifyTimestamp
getset

Definition at line 284 of file QuPath.cs.

284{ get; set; }

◆ Uri

string BioLib.QuPath.Project.Uri
getset

Definition at line 285 of file QuPath.cs.

285{ get; set; }

◆ Version

string BioLib.QuPath.Project.Version
getset

Definition at line 282 of file QuPath.cs.

282{ get; set; }

The documentation for this class was generated from the following file: