@@ -528,16 +528,18 @@ def run(self, workspace):
528528 self .input_object_name .value
529529 )
530530
531- objectcount = len (
532- measurements .get_current_measurement (
533- self .input_object_name .value , listofmeasurements [0 ]
534- )
535- )
536-
537531 if self .n_colors .value == ENCODING_TYPES [0 ]:
538532 measurements_for_calls = self .getallonehotbarcodemeasurements (
539533 listofmeasurements , self .ncycles .value , self .cycle1measure .value
540534 )
535+ first_cycle_measures = list (measurements_for_calls [1 ].keys ())
536+
537+ # Use a known barcode intensity measurement to determine object count
538+ objectcount = len (
539+ measurements .get_current_measurement (
540+ self .input_object_name .value , first_cycle_measures [0 ]
541+ )
542+ )
541543 calledbarcodes , quality_scores = self .callonehotbarcode (
542544 measurements_for_calls ,
543545 measurements ,
@@ -558,13 +560,11 @@ def run(self, workspace):
558560 "Image" , "_" .join ([C_CALL_BARCODES , "MeanQualityScore" ]), imagemeanquality
559561 )
560562 else :
561-
562563 calledbarcodes = self .calloneexpISSbarcode (
563564 self .base_measurements ,
564565 measurements ,
565566 self .input_object_name .value ,
566- self .ncycles .value ,
567- objectcount )
567+ self .ncycles .value )
568568
569569 workspace .measurements .add_measurement (
570570 self .input_object_name .value ,
@@ -671,7 +671,7 @@ def display(self, workspace, figure):
671671 figure .subplot_table (0 , 0 , statistics )
672672
673673 def calloneexpISSbarcode (self , calling_setting_dict , measurements ,
674- object_name , ncycles , objectcount ):
674+ object_name , ncycles ):
675675 def call_by_column (base_array ):
676676 base_order = ['A' ,'C' ,'G' ,'T' ]
677677 if sum (base_array ) != 1 :
@@ -690,6 +690,11 @@ def call_by_column(base_array):
690690 call_bool_dict [base ][eachmeas .base_boolean .value ] = [all_cycle_measurements ]
691691 else :
692692 call_bool_dict [base ][eachmeas .base_boolean .value ] += [all_cycle_measurements ]
693+ actual_measure_col = next (iter (call_bool_dict [base ].values ()))[0 ][1 ]
694+ objectcount = len (
695+ measurements .get_current_measurement (
696+ self .input_object_name .value , actual_measure_col )
697+ )
693698 full_base_array = numpy .zeros (objectcount ,dtype = "str" )
694699 base_list = ["A" , "C" , "G" , "T" ]
695700 for cycle in range (1 ,ncycles + 1 ):
0 commit comments