enum FunctionType {
Key
, Microscope
, Objective
, StoreCoordinate
,
NextCoordinate
, PreviousCoordinate
, NextSnapCoordinate
, PreviousSnapCoordinate
,
Recording
, Property
, ImageJ
, Script
,
None
}
enum ButtonState { Pressed = 0
, Released = 1
}
ButtonState State [get, set]
Gdk.Key Key [get, set]
Gdk.ModifierType Modifier [get, set]
FunctionType FuncType [get, set]
string File [get, set]
string Script [get, set]
string Name [get, set]
string MenuPath [get, set]
string ContextPath [get, set]
double Value [get, set]
string Microscope [get, set]
Definition at line 395 of file Functions.cs .
◆ ButtonState
enum BioGTK.Function.ButtonState
Definition at line 416 of file Functions.cs .
417 {
418 Pressed = 0,
419 Released = 1,
420 }
◆ FunctionType
enum BioGTK.Function.FunctionType
Definition at line 399 of file Functions.cs .
400 {
401 Key,
402 Microscope,
403 Objective,
404 StoreCoordinate,
405 NextCoordinate,
406 PreviousCoordinate,
407 NextSnapCoordinate,
408 PreviousSnapCoordinate,
409 Recording,
410 Property,
411 ImageJ,
412 Script,
413 None
414 }
◆ InitializeContextMenu()
static void BioGTK.Function.InitializeContextMenu
(
)
static
It reads all the files in the Functions folder, parses them into Function objects, and adds them to the Functions dictionary
Definition at line 625 of file Functions.cs .
626 {
627 string st = System.IO.Path.GetDirectoryName(Environment.ProcessPath) + "/Functions" ;
628 if (!Directory.Exists(st))
629 Directory.CreateDirectory(st);
630 string [] sts = Directory.GetFiles(st);
631 for (int i = 0; i < sts.Length; i++)
632 {
633 string fs = System.IO.File.ReadAllText(sts[i]);
634 Function f = Function.Parse(fs);
635 if (!Functions.ContainsKey(f.Name))
636 Functions.Add(f.Name, f);
637 App.AddContextMenu(f.ContextPath);
638 }
639 }
◆ InitializeMainMenu()
static void BioGTK.Function.InitializeMainMenu
(
)
static
It reads all the files in the Functions folder, parses them into Function objects, and adds them to the Functions dictionary
Definition at line 608 of file Functions.cs .
609 {
610 string st = System.IO.Path.GetDirectoryName(Environment.ProcessPath) + "/Functions" ;
611 if (!Directory.Exists(st))
612 Directory.CreateDirectory(st);
613 string [] sts = Directory.GetFiles(st);
614 for (int i = 0; i < sts.Length; i++)
615 {
616 string fs = System.IO.File.ReadAllText(sts[i]);
617 Function f = Function.Parse(fs);
618 if (!Functions.ContainsKey(f.Name))
619 Functions.Add(f.Name, f);
620 App.AddMenu(f.MenuPath);
621 }
622 }
◆ Parse()
static Function BioGTK.Function.Parse
(
string s )
static
It converts a string to a function.
Parameters
Returns A function object.
Definition at line 564 of file Functions.cs .
565 {
566 if (s == "" )
567 return new Function();
568 return JsonConvert.DeserializeObject<Function>(s);
569 }
◆ PerformFunction()
object BioGTK.Function.PerformFunction
(
bool imagej )
If the function type is a key, and the script is not empty, then if the imagej flag is true, set the function type to imagej, otherwise set the function type to script. If the function type is a script, run the script. If the function type is imagej, run the script on the image
Parameters
imagej boolean, whether to run the function as an ImageJ macro or not
Returns The return value is the result of the function.
Definition at line 586 of file Functions.cs .
587 {
588 if (FuncType == FunctionType.Key && Script != "" )
589 if (imagej)
590 {
591 FuncType = FunctionType.ImageJ;
592 }
593 else
594 FuncType = FunctionType.Script;
595 if (FuncType == Function.FunctionType.Script)
596 {
597 return Scripting.RunString(script);
598 }
599 if (FuncType == Function.FunctionType.ImageJ)
600 {
601 Fiji.RunOnImage(ImageView.SelectedImage,script, false , BioConsole.onTab, BioConsole.useBioformats, BioConsole.resultInNewTab);
602 }
603 return null ;
604 }
◆ Save()
void BioGTK.Function.Save
(
)
It saves the function to a file.
Definition at line 655 of file Functions.cs .
656 {
657 string st = System.IO.Path.GetDirectoryName(Environment.ProcessPath);
658 if (!Directory.Exists(st + "/Functions" ))
659 {
660 Directory.CreateDirectory(st + "/Functions" );
661 }
662 System.IO.File.WriteAllText(st +
"/Functions/" + Name +
".func" ,
Serialize ());
663 }
◆ SaveAll()
static void BioGTK.Function.SaveAll
(
)
static
It saves all the functions in the Functions dictionary to a file.
Definition at line 641 of file Functions.cs .
642 {
643 string st = System.IO.Path.GetDirectoryName(Environment.ProcessPath);
644
645 if (!Directory.Exists(st + "/Functions" ))
646 {
647 Directory.CreateDirectory(st + "/Functions" );
648 }
649 foreach (Function f in Functions.Values)
650 {
651 System.IO.File.WriteAllText(st + "/Functions/" + f.Name + ".func" , f.Serialize());
652 }
653 }
◆ Serialize()
string BioGTK.Function.Serialize
(
)
It takes the current object and converts it to a JSON string.
Returns The object is being serialized into a JSON string.
Definition at line 574 of file Functions.cs .
575 {
576 return JsonConvert.SerializeObject(this );
577 }
◆ ToString()
override string BioGTK.Function.ToString
(
)
Definition at line 555 of file Functions.cs .
556 {
557 return name + ", " + MenuPath;
558 }
◆ Functions
Dictionary<string, Function > BioGTK.Function.Functions = new Dictionary<string, Function >()
static
◆ ContextPath
string BioGTK.Function.ContextPath
get set
Definition at line 519 of file Functions.cs .
520 {
521 get
522 {
523 return contextPath;
524 }
525 set
526 {
527 contextPath = value;
528 }
529 }
◆ File
string BioGTK.Function.File
get set
Definition at line 478 of file Functions.cs .
479 {
480 get { return file; }
481 set { file = value; }
482 }
◆ FuncType
FunctionType BioGTK.Function.FuncType
get set
Definition at line 465 of file Functions.cs .
466 {
467 get
468 {
469 return functionType;
470 }
471 set
472 {
473 functionType = value;
474 }
475 }
◆ Key
Gdk.Key BioGTK.Function.Key
get set
Definition at line 437 of file Functions.cs .
438 {
439 get
440 {
441 return key;
442 }
443 set
444 {
445 key = value;
446 FuncType = FunctionType.Key;
447 }
448 }
◆ MenuPath
string BioGTK.Function.MenuPath
get set
Definition at line 507 of file Functions.cs .
508 {
509 get
510 {
511 return menuPath;
512 }
513 set
514 {
515 menuPath = value;
516 }
517 }
◆ Microscope
string BioGTK.Function.Microscope
get set
Definition at line 544 of file Functions.cs .
545 {
546 get
547 {
548 return microscope;
549 }
550 set
551 {
552 microscope = value;
553 }
554 }
◆ Modifier
Gdk.ModifierType BioGTK.Function.Modifier
get set
Definition at line 451 of file Functions.cs .
452 {
453 get
454 {
455 return modifier;
456 }
457 set
458 {
459 FuncType = FunctionType.Key;
460 modifier = value;
461 }
462 }
◆ Name
string BioGTK.Function.Name
get set
Definition at line 495 of file Functions.cs .
496 {
497 get
498 {
499 return name;
500 }
501 set
502 {
503 name = value;
504 }
505 }
◆ Script
string BioGTK.Function.Script
get set
Definition at line 485 of file Functions.cs .
486 {
487 get { return script; }
488 set
489 {
490 script = value;
491 }
492 }
◆ State
ButtonState BioGTK.Function.State
get set
Definition at line 424 of file Functions.cs .
425 {
426 get
427 {
428 return buttonState;
429 }
430 set
431 {
432 buttonState = value;
433 }
434 }
◆ Value
double BioGTK.Function.Value
get set
Definition at line 532 of file Functions.cs .
533 {
534 get
535 {
536 return val;
537 }
538 set
539 {
540 val = value;
541 }
542 }
The documentation for this class was generated from the following file: