spacr 0.1.64__py3-none-any.whl → 0.1.75__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
spacr/settings.py CHANGED
@@ -43,7 +43,7 @@ def set_default_settings_preprocess_generate_masks(src, settings={}):
43
43
  settings.setdefault('magnification', 20)
44
44
  settings.setdefault('custom_regex', None)
45
45
  settings.setdefault('metadata_type', 'cellvoyager')
46
- settings.setdefault('workers', os.cpu_count()-4)
46
+ settings.setdefault('n_job', os.cpu_count()-4)
47
47
  settings.setdefault('randomize', True)
48
48
  settings.setdefault('verbose', True)
49
49
  settings.setdefault('remove_background_cell', False)
@@ -254,7 +254,7 @@ def get_measure_crop_settings(settings):
254
254
  settings.setdefault('plot',False)
255
255
  settings.setdefault('plot_filtration',False)
256
256
  settings.setdefault('representative_images', False)
257
- settings.setdefault('max_workers', os.cpu_count()-2)
257
+ settings.setdefault('n_job', os.cpu_count()-2)
258
258
 
259
259
  # Object settings
260
260
  settings.setdefault('cell_mask_dim',None)
@@ -340,7 +340,7 @@ def set_default_train_test_model(settings):
340
340
  settings.setdefault('gradient_accumulation_steps',4)
341
341
  settings.setdefault('intermedeate_save',True)
342
342
  settings.setdefault('pin_memory',True)
343
- settings.setdefault('num_workers',cores)
343
+ settings.setdefault('n_job',cores)
344
344
  settings.setdefault('channels',['r','g','b'])
345
345
  settings.setdefault('augment',False)
346
346
  settings.setdefault('verbose',False)
@@ -490,266 +490,264 @@ def get_identify_masks_finetune_default_settings(settings):
490
490
  return settings
491
491
 
492
492
  q = None
493
+ expected_types = {
494
+ "src": str,
495
+ "metadata_type": str,
496
+ "custom_regex": (str, type(None)),
497
+ "experiment": str,
498
+ "channels": list,
499
+ "magnification": int,
500
+ "nucleus_channel": (int, type(None)),
501
+ "nucleus_background": int,
502
+ "nucleus_Signal_to_noise": float,
503
+ "nucleus_CP_prob": float,
504
+ "nucleus_FT": float,
505
+ "cell_channel": (int, type(None)),
506
+ "cell_background": (int, float),
507
+ "cell_Signal_to_noise": (int, float),
508
+ "cell_CP_prob": (int, float),
509
+ "cell_FT": (int, float),
510
+ "pathogen_channel": (int, type(None)),
511
+ "pathogen_background": (int, float),
512
+ "pathogen_Signal_to_noise": (int, float),
513
+ "pathogen_CP_prob": (int, float),
514
+ "pathogen_FT": (int, float),
515
+ "preprocess": bool,
516
+ "masks": bool,
517
+ "examples_to_plot": int,
518
+ "randomize": bool,
519
+ "batch_size": int,
520
+ "timelapse": bool,
521
+ "timelapse_displacement": int,
522
+ "timelapse_memory": int,
523
+ "timelapse_frame_limits": list, # This can be a list of lists
524
+ "timelapse_remove_transient": bool,
525
+ "timelapse_mode": str,
526
+ "timelapse_objects": list,
527
+ "fps": int,
528
+ "remove_background": bool,
529
+ "lower_percentile": (int, float),
530
+ "merge_pathogens": bool,
531
+ "normalize_plots": bool,
532
+ "all_to_mip": bool,
533
+ "pick_slice": bool,
534
+ "skip_mode": str,
535
+ "save": bool,
536
+ "plot": bool,
537
+ "n_job": int,
538
+ "verbose": bool,
539
+ "input_folder": str,
540
+ "cell_mask_dim": int,
541
+ "cell_min_size": int,
542
+ "cytoplasm_min_size": int,
543
+ "nucleus_mask_dim": int,
544
+ "nucleus_min_size": int,
545
+ "pathogen_mask_dim": int,
546
+ "pathogen_min_size": int,
547
+ "save_png": bool,
548
+ "crop_mode": list,
549
+ "use_bounding_box": bool,
550
+ "png_size": list, # This can be a list of lists
551
+ "normalize": bool,
552
+ "png_dims": list,
553
+ "normalize_by": str,
554
+ "save_measurements": bool,
555
+ "representative_images": bool,
556
+ "plot_filtration": bool,
557
+ "include_uninfected": bool,
558
+ "dialate_pngs": bool,
559
+ "dialate_png_ratios": list,
560
+ "n_job": int,
561
+ "cells": list,
562
+ "cell_loc": list,
563
+ "pathogens": list,
564
+ "pathogen_loc": (list, list), # This can be a list of lists
565
+ "treatments": list,
566
+ "treatment_loc": (list, list), # This can be a list of lists
567
+ "channel_of_interest": int,
568
+ "compartments": list,
569
+ "measurement": str,
570
+ "nr_imgs": int,
571
+ "um_per_pixel": (int, float),
572
+ # Additional settings based on provided defaults
573
+ "include_noninfected": bool,
574
+ "include_multiinfected": bool,
575
+ "include_multinucleated": bool,
576
+ "filter_min_max": (list, type(None)),
577
+ "channel_dims": list,
578
+ "backgrounds": list,
579
+ "outline_thickness": int,
580
+ "outline_color": str,
581
+ "overlay_chans": list,
582
+ "overlay": bool,
583
+ "normalization_percentiles": list,
584
+ "print_object_number": bool,
585
+ "nr": int,
586
+ "figuresize": int,
587
+ "cmap": str,
588
+ "test_mode": bool,
589
+ "test_images": int,
590
+ "remove_background_cell": bool,
591
+ "remove_background_nucleus": bool,
592
+ "remove_background_pathogen": bool,
593
+ "pathogen_model": (str, type(None)),
594
+ "filter": bool,
595
+ "upscale": bool,
596
+ "upscale_factor": float,
597
+ "adjust_cells": bool,
598
+ "row_limit": int,
599
+ "tables": list,
600
+ "visualize": str,
601
+ "image_nr": int,
602
+ "dot_size": int,
603
+ "n_neighbors": int,
604
+ "min_dist": float,
605
+ "metric": str,
606
+ "eps": float,
607
+ "min_samples": int,
608
+ "filter_by": str,
609
+ "img_zoom": float,
610
+ "plot_by_cluster": bool,
611
+ "plot_cluster_grids": bool,
612
+ "remove_cluster_noise": bool,
613
+ "remove_highly_correlated": bool,
614
+ "log_data": bool,
615
+ "black_background": bool,
616
+ "remove_image_canvas": bool,
617
+ "plot_outlines": bool,
618
+ "plot_points": bool,
619
+ "smooth_lines": bool,
620
+ "clustering": str,
621
+ "exclude": (str, type(None)),
622
+ "col_to_compare": str,
623
+ "pos": str,
624
+ "neg": str,
625
+ "embedding_by_controls": bool,
626
+ "plot_images": bool,
627
+ "reduction_method": str,
628
+ "save_figure": bool,
629
+ "color_by": (str, type(None)),
630
+ "analyze_clusters": bool,
631
+ "resnet_features": bool,
632
+ "test_nr": int,
633
+ "radial_dist": bool,
634
+ "calculate_correlation": bool,
635
+ "manders_thresholds": list,
636
+ "homogeneity": bool,
637
+ "homogeneity_distances": list,
638
+ "save_arrays": bool,
639
+ "cytoplasm": bool,
640
+ "merge_edge_pathogen_cells": bool,
641
+ "cells_per_well": int,
642
+ "pathogen_size_range": list,
643
+ "nucleus_size_range": list,
644
+ "cell_size_range": list,
645
+ "pathogen_intensity_range": list,
646
+ "nucleus_intensity_range": list,
647
+ "cell_intensity_range": list,
648
+ "target_intensity_min": int,
649
+ "model_type": str,
650
+ "heatmap_feature": str,
651
+ "grouping": str,
652
+ "min_max": str,
653
+ "minimum_cell_count": int,
654
+ "n_estimators": int,
655
+ "test_size": float,
656
+ "location_column": str,
657
+ "positive_control": str,
658
+ "negative_control": str,
659
+ "n_repeats": int,
660
+ "top_features": int,
661
+ "remove_low_variance_features": bool,
662
+ "n_jobs": int,
663
+ "classes": list,
664
+ "schedule": str,
665
+ "loss_type": str,
666
+ "image_size": int,
667
+ "epochs": int,
668
+ "val_split": float,
669
+ "train_mode": str,
670
+ "learning_rate": float,
671
+ "weight_decay": float,
672
+ "dropout_rate": float,
673
+ "init_weights": bool,
674
+ "amsgrad": bool,
675
+ "use_checkpoint": bool,
676
+ "gradient_accumulation": bool,
677
+ "gradient_accumulation_steps": int,
678
+ "intermedeate_save": bool,
679
+ "pin_memory": bool,
680
+ "n_job": int,
681
+ "augment": bool,
682
+ "target": str,
683
+ "cell_types": list,
684
+ "cell_plate_metadata": (list, type(None)),
685
+ "pathogen_types": list,
686
+ "pathogen_plate_metadata": (list, list), # This can be a list of lists
687
+ "treatment_plate_metadata": (list, list), # This can be a list of lists
688
+ "metadata_types": list,
689
+ "cell_chann_dim": int,
690
+ "nucleus_chann_dim": int,
691
+ "pathogen_chann_dim": int,
692
+ "plot_nr": int,
693
+ "plot_control": bool,
694
+ "remove_background": bool,
695
+ "target": str,
696
+ "upstream": str,
697
+ "downstream": str,
698
+ "barecode_length_1": int,
699
+ "barecode_length_2": int,
700
+ "chunk_size": int,
701
+ "grna": str,
702
+ "barcodes": str,
703
+ "plate_dict": dict,
704
+ "pc": str,
705
+ "pc_loc": str,
706
+ "nc": str,
707
+ "nc_loc": str,
708
+ "dependent_variable": str,
709
+ "transform": (str, type(None)),
710
+ "agg_type": str,
711
+ "min_cell_count": int,
712
+ "regression_type": str,
713
+ "remove_row_column_effect": bool,
714
+ "alpha": float,
715
+ "fraction_threshold": float,
716
+ "class_1_threshold": (float, type(None)),
717
+ "batch_size": int,
718
+ "CP_prob": float,
719
+ "flow_threshold": float,
720
+ "percentiles": (list, type(None)),
721
+ "circular": bool,
722
+ "invert": bool,
723
+ "diameter": int,
724
+ "grayscale": bool,
725
+ "resize": bool,
726
+ "target_height": (int, type(None)),
727
+ "target_width": (int, type(None)),
728
+ "rescale": bool,
729
+ "resample": bool,
730
+ "model_name": str,
731
+ "Signal_to_noise": int,
732
+ "learning_rate": float,
733
+ "weight_decay": float,
734
+ "batch_size": int,
735
+ "n_epochs": int,
736
+ "from_scratch": bool,
737
+ "width_height": list,
738
+ "resize": bool,
739
+ "gene_weights_csv": str,
740
+ "fraction_threshold": float,
741
+ }
493
742
 
494
- def check_settings(vars_dict):
495
- global q
743
+ def check_settings_v1(vars_dict, expected_types,q=None):
496
744
  from .gui_utils import parse_list
497
745
  settings = {}
498
746
  # Define the expected types for each key, including None where applicable
499
- expected_types = {
500
- "src": str,
501
- "metadata_type": str,
502
- "custom_regex": (str, type(None)),
503
- "experiment": str,
504
- "channels": list,
505
- "magnification": int,
506
- "nucleus_channel": (int, type(None)),
507
- "nucleus_background": int,
508
- "nucleus_Signal_to_noise": float,
509
- "nucleus_CP_prob": float,
510
- "nucleus_FT": float,
511
- "cell_channel": (int, type(None)),
512
- "cell_background": (int, float),
513
- "cell_Signal_to_noise": (int, float),
514
- "cell_CP_prob": (int, float),
515
- "cell_FT": (int, float),
516
- "pathogen_channel": (int, type(None)),
517
- "pathogen_background": (int, float),
518
- "pathogen_Signal_to_noise": (int, float),
519
- "pathogen_CP_prob": (int, float),
520
- "pathogen_FT": (int, float),
521
- "preprocess": bool,
522
- "masks": bool,
523
- "examples_to_plot": int,
524
- "randomize": bool,
525
- "batch_size": int,
526
- "timelapse": bool,
527
- "timelapse_displacement": int,
528
- "timelapse_memory": int,
529
- "timelapse_frame_limits": list, # This can be a list of lists
530
- "timelapse_remove_transient": bool,
531
- "timelapse_mode": str,
532
- "timelapse_objects": list,
533
- "fps": int,
534
- "remove_background": bool,
535
- "lower_percentile": (int, float),
536
- "merge_pathogens": bool,
537
- "normalize_plots": bool,
538
- "all_to_mip": bool,
539
- "pick_slice": bool,
540
- "skip_mode": str,
541
- "save": bool,
542
- "plot": bool,
543
- "workers": int,
544
- "verbose": bool,
545
- "input_folder": str,
546
- "cell_mask_dim": int,
547
- "cell_min_size": int,
548
- "cytoplasm_min_size": int,
549
- "nucleus_mask_dim": int,
550
- "nucleus_min_size": int,
551
- "pathogen_mask_dim": int,
552
- "pathogen_min_size": int,
553
- "save_png": bool,
554
- "crop_mode": list,
555
- "use_bounding_box": bool,
556
- "png_size": list, # This can be a list of lists
557
- "normalize": bool,
558
- "png_dims": list,
559
- "normalize_by": str,
560
- "save_measurements": bool,
561
- "representative_images": bool,
562
- "plot_filtration": bool,
563
- "include_uninfected": bool,
564
- "dialate_pngs": bool,
565
- "dialate_png_ratios": list,
566
- "max_workers": int,
567
- "cells": list,
568
- "cell_loc": list,
569
- "pathogens": list,
570
- "pathogen_loc": (list, list), # This can be a list of lists
571
- "treatments": list,
572
- "treatment_loc": (list, list), # This can be a list of lists
573
- "channel_of_interest": int,
574
- "compartments": list,
575
- "measurement": str,
576
- "nr_imgs": int,
577
- "um_per_pixel": (int, float),
578
- # Additional settings based on provided defaults
579
- "include_noninfected": bool,
580
- "include_multiinfected": bool,
581
- "include_multinucleated": bool,
582
- "filter_min_max": (list, type(None)),
583
- "channel_dims": list,
584
- "backgrounds": list,
585
- "outline_thickness": int,
586
- "outline_color": str,
587
- "overlay_chans": list,
588
- "overlay": bool,
589
- "normalization_percentiles": list,
590
- "print_object_number": bool,
591
- "nr": int,
592
- "figuresize": int,
593
- "cmap": str,
594
- "test_mode": bool,
595
- "test_images": int,
596
- "remove_background_cell": bool,
597
- "remove_background_nucleus": bool,
598
- "remove_background_pathogen": bool,
599
- "pathogen_model": (str, type(None)),
600
- "filter": bool,
601
- "upscale": bool,
602
- "upscale_factor": float,
603
- "adjust_cells": bool,
604
- "row_limit": int,
605
- "tables": list,
606
- "visualize": str,
607
- "image_nr": int,
608
- "dot_size": int,
609
- "n_neighbors": int,
610
- "min_dist": float,
611
- "metric": str,
612
- "eps": float,
613
- "min_samples": int,
614
- "filter_by": str,
615
- "img_zoom": float,
616
- "plot_by_cluster": bool,
617
- "plot_cluster_grids": bool,
618
- "remove_cluster_noise": bool,
619
- "remove_highly_correlated": bool,
620
- "log_data": bool,
621
- "black_background": bool,
622
- "remove_image_canvas": bool,
623
- "plot_outlines": bool,
624
- "plot_points": bool,
625
- "smooth_lines": bool,
626
- "clustering": str,
627
- "exclude": (str, type(None)),
628
- "col_to_compare": str,
629
- "pos": str,
630
- "neg": str,
631
- "embedding_by_controls": bool,
632
- "plot_images": bool,
633
- "reduction_method": str,
634
- "save_figure": bool,
635
- "color_by": (str, type(None)),
636
- "analyze_clusters": bool,
637
- "resnet_features": bool,
638
- "test_nr": int,
639
- "radial_dist": bool,
640
- "calculate_correlation": bool,
641
- "manders_thresholds": list,
642
- "homogeneity": bool,
643
- "homogeneity_distances": list,
644
- "save_arrays": bool,
645
- "cytoplasm": bool,
646
- "merge_edge_pathogen_cells": bool,
647
- "cells_per_well": int,
648
- "pathogen_size_range": list,
649
- "nucleus_size_range": list,
650
- "cell_size_range": list,
651
- "pathogen_intensity_range": list,
652
- "nucleus_intensity_range": list,
653
- "cell_intensity_range": list,
654
- "target_intensity_min": int,
655
- "model_type": str,
656
- "heatmap_feature": str,
657
- "grouping": str,
658
- "min_max": str,
659
- "minimum_cell_count": int,
660
- "n_estimators": int,
661
- "test_size": float,
662
- "location_column": str,
663
- "positive_control": str,
664
- "negative_control": str,
665
- "n_repeats": int,
666
- "top_features": int,
667
- "remove_low_variance_features": bool,
668
- "n_jobs": int,
669
- "classes": list,
670
- "schedule": str,
671
- "loss_type": str,
672
- "image_size": int,
673
- "epochs": int,
674
- "val_split": float,
675
- "train_mode": str,
676
- "learning_rate": float,
677
- "weight_decay": float,
678
- "dropout_rate": float,
679
- "init_weights": bool,
680
- "amsgrad": bool,
681
- "use_checkpoint": bool,
682
- "gradient_accumulation": bool,
683
- "gradient_accumulation_steps": int,
684
- "intermedeate_save": bool,
685
- "pin_memory": bool,
686
- "num_workers": int,
687
- "augment": bool,
688
- "target": str,
689
- "cell_types": list,
690
- "cell_plate_metadata": (list, type(None)),
691
- "pathogen_types": list,
692
- "pathogen_plate_metadata": (list, list), # This can be a list of lists
693
- "treatment_plate_metadata": (list, list), # This can be a list of lists
694
- "metadata_types": list,
695
- "cell_chann_dim": int,
696
- "nucleus_chann_dim": int,
697
- "pathogen_chann_dim": int,
698
- "plot_nr": int,
699
- "plot_control": bool,
700
- "remove_background": bool,
701
- "target": str,
702
- "upstream": str,
703
- "downstream": str,
704
- "barecode_length_1": int,
705
- "barecode_length_2": int,
706
- "chunk_size": int,
707
- "grna": str,
708
- "barcodes": str,
709
- "plate_dict": dict,
710
- "pc": str,
711
- "pc_loc": str,
712
- "nc": str,
713
- "nc_loc": str,
714
- "dependent_variable": str,
715
- "transform": (str, type(None)),
716
- "agg_type": str,
717
- "min_cell_count": int,
718
- "regression_type": str,
719
- "remove_row_column_effect": bool,
720
- "alpha": float,
721
- "fraction_threshold": float,
722
- "class_1_threshold": (float, type(None)),
723
- "batch_size": int,
724
- "CP_prob": float,
725
- "flow_threshold": float,
726
- "percentiles": (list, type(None)),
727
- "circular": bool,
728
- "invert": bool,
729
- "diameter": int,
730
- "grayscale": bool,
731
- "resize": bool,
732
- "target_height": (int, type(None)),
733
- "target_width": (int, type(None)),
734
- "rescale": bool,
735
- "resample": bool,
736
- "model_name": str,
737
- "Signal_to_noise": int,
738
- "learning_rate": float,
739
- "weight_decay": float,
740
- "batch_size": int,
741
- "n_epochs": int,
742
- "from_scratch": bool,
743
- "width_height": list,
744
- "resize": bool,
745
- "gene_weights_csv": str,
746
- "fraction_threshold": float,
747
- }
748
747
 
749
748
  for key, (label, widget, var) in vars_dict.items():
750
749
  if key not in expected_types:
751
750
  if key not in ["General","Nucleus","Cell","Pathogen","Timelapse","Plot","Object Image","Annotate Data","Measurements","Advanced","Miscellaneous","Test"]:
752
-
753
751
  q.put(f"Key {key} not found in expected types.")
754
752
  continue
755
753
 
@@ -796,6 +794,64 @@ def check_settings(vars_dict):
796
794
 
797
795
  return settings
798
796
 
797
+ def check_settings(vars_dict, expected_types, q=None):
798
+ from .gui_utils import parse_list
799
+
800
+ if q is None:
801
+ from multiprocessing import Queue
802
+ q = Queue()
803
+
804
+ settings = {}
805
+
806
+ for key, (label, widget, var) in vars_dict.items():
807
+ if key not in expected_types:
808
+ if key not in ["General", "Nucleus", "Cell", "Pathogen", "Timelapse", "Plot", "Object Image", "Annotate Data", "Measurements", "Advanced", "Miscellaneous", "Test"]:
809
+ q.put(f"Key {key} not found in expected types.")
810
+ continue
811
+
812
+ value = var.get()
813
+ expected_type = expected_types.get(key, str)
814
+
815
+ try:
816
+ if key in ["png_size", "pathogen_plate_metadata", "treatment_plate_metadata"]:
817
+ parsed_value = ast.literal_eval(value) if value else None
818
+ if isinstance(parsed_value, list):
819
+ if all(isinstance(i, list) for i in parsed_value) or all(not isinstance(i, list) for i in parsed_value):
820
+ settings[key] = parsed_value
821
+ else:
822
+ raise ValueError("Invalid format: Mixed list and list of lists")
823
+ else:
824
+ raise ValueError("Invalid format for list or list of lists")
825
+ elif expected_type == list:
826
+ settings[key] = parse_list(value) if value else None
827
+ elif expected_type == bool:
828
+ settings[key] = value if isinstance(value, bool) else value.lower() in ['true', '1', 't', 'y', 'yes']
829
+ elif expected_type == (int, type(None)):
830
+ settings[key] = int(value) if value else None
831
+ elif expected_type == (float, type(None)):
832
+ settings[key] = float(value) if value else None
833
+ elif expected_type == (int, float):
834
+ settings[key] = float(value) if '.' in value else int(value)
835
+ elif expected_type == (str, type(None)):
836
+ settings[key] = str(value) if value else None
837
+ elif isinstance(expected_type, tuple):
838
+ for typ in expected_type:
839
+ try:
840
+ settings[key] = typ(value) if value else None
841
+ break
842
+ except (ValueError, TypeError):
843
+ continue
844
+ else:
845
+ raise ValueError
846
+ else:
847
+ settings[key] = expected_type(value) if value else None
848
+ except (ValueError, SyntaxError) as e:
849
+ expected_type_name = ' or '.join([t.__name__ for t in expected_type]) if isinstance(expected_type, tuple) else expected_type.__name__
850
+ q.put(f"Error: Invalid format for {key}. Expected type: {expected_type_name}. Error: {e}")
851
+ return
852
+
853
+ return settings
854
+
799
855
  def generate_fields(variables, scrollable_frame):
800
856
  from .gui_utils import create_input_field
801
857
  from .gui_elements import spacrToolTip
@@ -846,7 +902,7 @@ def generate_fields(variables, scrollable_frame):
846
902
  "save": "Whether to save the results to disk.",
847
903
  "merge_edge_pathogen_cells": "Whether to merge cells that share pathogen objects.",
848
904
  "plot": "Whether to plot the results.",
849
- "workers": "The number of workers to use for processing the images. This will determine how many images are processed in parallel. Increase to speed up processing.",
905
+ "n_job": "The number of n_job to use for processing the images. This will determine how many images are processed in parallel. Increase to speed up processing.",
850
906
  "verbose": "Whether to print verbose output during processing.",
851
907
  "input_folder": "Path to the folder containing the images.",
852
908
  "cell_mask_dim": "The dimension of the array the cell mask is saved in.",
@@ -870,7 +926,7 @@ def generate_fields(variables, scrollable_frame):
870
926
  "include_uninfected": "Whether to include uninfected cells in the analysis.",
871
927
  "dialate_pngs": "Whether to dilate the PNG images before saving.",
872
928
  "dialate_png_ratios": "The ratios to use for dilating the PNG images. This will determine the amount of dilation applied to the images before cropping.",
873
- "max_workers": "The number of workers to use for processing the images. This will determine how many images are processed in parallel. Increase to speed up processing.",
929
+ "n_job": "The number of n_job to use for processing the images. This will determine how many images are processed in parallel. Increase to speed up processing.",
874
930
  "cells": "The cell types to include in the analysis.",
875
931
  "cell_loc": "The locations of the cell types in the images.",
876
932
  "pathogens": "The pathogen types to include in the analysis.",
@@ -899,12 +955,12 @@ categories = {
899
955
  "Nucleus": ["nucleus_channel", "nucleus_background", "nucleus_Signal_to_noise", "nucleus_CP_prob", "nucleus_FT", "remove_background_nucleus", "nucleus_min_size", "nucleus_mask_dim", "nucleus_loc"],
900
956
  "Cell": ["cell_channel", "cell_background", "cell_Signal_to_noise", "cell_CP_prob", "cell_FT", "remove_background_cell", "cell_min_size", "cell_mask_dim", "cytoplasm", "cytoplasm_min_size", "include_uninfected", "merge_edge_pathogen_cells", "adjust_cells"],
901
957
  "Pathogen": ["pathogen_channel", "pathogen_background", "pathogen_Signal_to_noise", "pathogen_CP_prob", "pathogen_FT", "pathogen_model", "remove_background_pathogen", "pathogen_min_size", "pathogen_mask_dim"],
902
- "Timelapse": ["timelapse", "fps", "timelapse_displacement", "timelapse_memory", "timelapse_frame_limits", "timelapse_remove_transient", "timelapse_mode", "timelapse_objects", "compartments"],
903
- "Plot": ["plot_filtration", "examples_to_plot", "normalize_plots", "normalize", "cmap", "figuresize", "plot", "plot_cluster_grids", "img_zoom", "row_limit", "color_by", "plot_images", "smooth_lines", "plot_points", "plot_outlines", "black_background", "plot_by_cluster", "heatmap_feature","grouping","min_max","cmap","save_figure"],
958
+ "Timelapse": ["fps", "timelapse_displacement", "timelapse_memory", "timelapse_frame_limits", "timelapse_remove_transient", "timelapse_mode", "timelapse_objects", "compartments"],
959
+ "Plot": ["plot_filtration", "examples_to_plot", "normalize_plots", "normalize", "cmap", "figuresize", "plot_cluster_grids", "img_zoom", "row_limit", "color_by", "plot_images", "smooth_lines", "plot_points", "plot_outlines", "black_background", "plot_by_cluster", "heatmap_feature","grouping","min_max","cmap","save_figure"],
904
960
  "Object Image": ["save_png", "dialate_pngs", "dialate_png_ratios", "png_size", "png_dims", "save_arrays", "normalize_by", "dialate_png_ratios", "crop_mode", "dialate_pngs", "normalize", "use_bounding_box"],
905
961
  "Annotate Data": ["positive_control","negative_control", "location_column", "treatment_loc", "cells", "cell_loc", "pathogens", "pathogen_loc", "channel_of_interest", "measurement", "treatments", "representative_images", "um_per_pixel", "nr_imgs", "exclude", "exclude_conditions", "mix", "pos", "neg"],
906
962
  "Measurements": ["remove_image_canvas", "remove_highly_correlated", "homogeneity", "homogeneity_distances", "radial_dist", "calculate_correlation", "manders_thresholds", "save_measurements", "tables", "image_nr", "dot_size", "filter_by", "remove_highly_correlated_features", "remove_low_variance_features", "channel_of_interest"],
907
- "Advanced": ["schedule", "test_size","exclude","n_repeats","top_features","n_jobs", "model_type","minimum_cell_count","n_estimators","preprocess", "remove_background", "normalize", "lower_percentile", "merge_pathogens", "batch_size", "filter", "save", "masks", "verbose", "randomize", "max_workers", "workers", "train_mode","amsgrad","use_checkpoint","gradient_accumulation","gradient_accumulation_steps","intermedeate_save","pin_memory","num_workers","channels","augment"],
963
+ "Advanced": ["plot", "timelapse", "schedule", "test_size","exclude","n_repeats","top_features", "model_type","minimum_cell_count","n_estimators","preprocess", "remove_background", "normalize", "lower_percentile", "merge_pathogens", "batch_size", "filter", "save", "masks", "verbose", "randomize", "n_job", "train_mode","amsgrad","use_checkpoint","gradient_accumulation","gradient_accumulation_steps","intermedeate_save","pin_memory","n_job","channels","augment"],
908
964
  "Clustering": ["eps","min_samples","analyze_clusters","clustering","remove_cluster_noise"],
909
965
  "Embedding": ["visualize","n_neighbors","min_dist","metric","resnet_features","reduction_method","embedding_by_controls","col_to_compare","log_data"],
910
966
  "Train DL Model": ["epochs", "loss_type", "optimizer_type","image_size","val_split","learning_rate","weight_decay","dropout_rate","init_weights", "train", "classes"],
@@ -912,3 +968,18 @@ categories = {
912
968
  "Test": ["test_mode", "test_images", "random_test", "test_nr"],
913
969
  "Sequencing": ["upstream", "downstream", "barecode_length_1", "barecode_length_2", "chunk_size", "test"]
914
970
  }
971
+
972
+ def set_annotate_default_settings(settings):
973
+ settings.setdefault('src', 'path')
974
+ settings.setdefault('image_type', 'cell_png')
975
+ settings.setdefault('channels', 'r,g,b')
976
+ settings.setdefault('geom', "3200x2000")
977
+ settings.setdefault('img_size', [200, 200])
978
+ settings.setdefault('rows', 10)
979
+ settings.setdefault('columns', 18)
980
+ settings.setdefault('annotation_column', 'test')
981
+ settings.setdefault('normalize', 'False')
982
+ settings.setdefault('percentiles', [2, 98])
983
+ settings.setdefault('measurement', 'cytoplasm_channel_3_mean_intensity,pathogen_channel_3_mean_intensity')
984
+ settings.setdefault('threshold', '2')
985
+ return settings
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: spacr
3
- Version: 0.1.64
3
+ Version: 0.1.75
4
4
  Summary: Spatial phenotype analysis of crisp screens (SpaCr)
5
5
  Home-page: https://github.com/EinarOlafsson/spacr
6
6
  Author: Einar Birnir Olafsson