Skip to content

Commit

Permalink
update test code to include BasicModule.countTissuePieces test case
Browse files Browse the repository at this point in the history
  • Loading branch information
nanli-emory committed Aug 16, 2024
1 parent a17b08a commit d002b2d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion histoqc/SaveModule.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def saveFinalMask(s, params):


def saveAssociatedImage(s, key:str, dim:int):
logging.info(f"{s['filename']} - \tsave{key.capitalize()}")
logging.info(f"{s['filename']}- save{key.capitalize()}")
osh = s["os_handle"]

if not key in osh.associated_images:
Expand Down
6 changes: 3 additions & 3 deletions histoqc/tests/target/results.tsv
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#start_time: 2023-12-06 11:00:41.788659
#pipeline: BasicModule.getBasicStats LightDarkModule.saveEqualisedImage LightDarkModule.minimumPixelIntensityNeighborhoodFiltering LightDarkModule.getIntensityThresholdPercent:darktissue BubbleRegionByRegion.detectSmoothness MorphologyModule.removeFatlikeTissue MorphologyModule.fillSmallHoles MorphologyModule.removeSmallObjects LocalTextureEstimationModule.estimateGreyComatrixFeatures:background BrightContrastModule.getContrast:background BrightContrastModule.getBrightnessGray:background BrightContrastModule.getBrightnessByChannelinColorSpace:RGB_background BlurDetectionModule.identifyBlurryRegions BasicModule.finalProcessingSpur BasicModule.finalProcessingArea HistogramModule.compareToTemplates HistogramModule.getHistogram LocalTextureEstimationModule.estimateGreyComatrixFeatures:final BrightContrastModule.getContrast BrightContrastModule.getBrightnessGray BrightContrastModule.getBrightnessByChannelinColorSpace:RGB BrightContrastModule.getBrightnessByChannelinColorSpace:YUV DeconvolutionModule.separateStains SaveModule.saveFinalMask SaveModule.saveMacro SaveModule.saveThumbnails BasicModule.finalComputations
#pipeline: BasicModule.getBasicStats LightDarkModule.saveEqualisedImage LightDarkModule.minimumPixelIntensityNeighborhoodFiltering LightDarkModule.getIntensityThresholdPercent:darktissue BubbleRegionByRegion.detectSmoothness MorphologyModule.removeFatlikeTissue MorphologyModule.fillSmallHoles MorphologyModule.removeSmallObjects LocalTextureEstimationModule.estimateGreyComatrixFeatures:background BrightContrastModule.getContrast:background BrightContrastModule.getBrightnessGray:background BrightContrastModule.getBrightnessByChannelinColorSpace:RGB_background BlurDetectionModule.identifyBlurryRegions BasicModule.finalProcessingSpur BasicModule.finalProcessingArea HistogramModule.compareToTemplates HistogramModule.getHistogram LocalTextureEstimationModule.estimateGreyComatrixFeatures:final BrightContrastModule.getContrast BrightContrastModule.getBrightnessGray BrightContrastModule.getBrightnessByChannelinColorSpace:RGB BrightContrastModule.getBrightnessByChannelinColorSpace:YUV DeconvolutionModule.separateStains SaveModule.saveFinalMask SaveModule.saveMacro SaveModule.saveThumbnails BasicModule.countTissuePieces BasicModule.finalComputations
#outdir: /Users/nanli/Documents/github/HistoQC/histoqc/tests/new
#config_file: /Users/nanli/Documents/github/HistoQC/histoqc/config/config_v2.1.ini
#command_line_args: -c ./histoqc/config/config_v2.1.ini -o ./histoqc/tests/new -s 123 ./histoqc/tests/data/TCGA-EJ-5509-01A-01-BS1_ROI.svs
#dataset:filename comments image_bounding_box base_mag type levels height width mpp_x mpp_y comment brightestPixels dark flat_areas fatlike_tissue_removed_num_regions fatlike_tissue_removed_mean_area fatlike_tissue_removed_max_area fatlike_tissue_removed_percent small_tissue_filled_num_regions small_tissue_filled_mean_area small_tissue_filled_max_area small_tissue_filled_percent small_tissue_removed_num_regions small_tissue_removed_mean_area small_tissue_removed_max_area small_tissue_removed_percent background_contrast background_contrast_std background_dissimilarity background_dissimilarity_std background_homogeneity background_homogeneity_std background_ASM background_ASM_std background_energy background_energy_std background_correlation background_correlation_std background_tenenGrad_contrast background_michelson_contrast background_rms_contrast background_grayscale_brightness background_grayscale_brightness_std background_chan1_brightness background_chan1_brightness_std background_chan2_brightness background_chan2_brightness_std background_chan3_brightness background_chan3_brightness_std blurry_removed_num_regions blurry_removed_mean_area blurry_removed_max_area blurry_removed_percent spur_pixels areaThresh template1_MSE_hist template2_MSE_hist template3_MSE_hist template4_MSE_hist final_contrast final_contrast_std final_dissimilarity final_dissimilarity_std final_homogeneity final_homogeneity_std final_ASM final_ASM_std final_energy final_energy_std final_correlation final_correlation_std tenenGrad_contrast michelson_contrast rms_contrast grayscale_brightness grayscale_brightness_std chan1_brightness chan1_brightness_std chan2_brightness chan2_brightness_std chan3_brightness chan3_brightness_std chan1_brightness_YUV chan1_brightness_std_YUV chan2_brightness_YUV chan2_brightness_std_YUV chan3_brightness_YUV chan3_brightness_std_YUV deconv_c0_mean deconv_c0_std deconv_c1_mean deconv_c1_std deconv_c2_mean deconv_c2_std pixels_to_use warnings
TCGA-EJ-5509-01A-01-BS1_ROI.svs (0, 0, 4092, 4092) 20.0 aperio 1 4092 4092 0.50149999999999995 0.50149999999999995 Aperio Fake |AppMag = 20|MPP = 0.5015 0.2487945556640625 0.0063374702931080495 0.006582309532083608 0 0 0 0.0 165 1.8909090909090909 15 -0.006420149391937802 1 10.0 10 0.00020446134658247406 1.0098250225817402 1.6726571860607253 0.2528666764200787 0.4252018475618517 0.9337698968400423 0.1142845916582232 0.8404324661847189 0.2749993733706908 0.897567529038673 0.18656097394720528 0.5999317010355991 0.4234307078840679 9.538838020360488e-06 0.9268259509452782 0.18247882870888657 0.9186934437180535 0.005377040601787484 235.76269760173108 1.3349606666359373 233.56590731502072 1.473921948906114 236.81282683176053 0.9182862023596723 3 1744.6666666666667 4915 0.10703695372093502 0.0 0.0 0.0005713989005378889 0.00210218250820665 0.00037149510237524463 0.0022534729516800454 2.4557276884185666 1.068922962978307 1.1239287111502159 0.3038952269197558 0.529846271258571 0.10999022358426115 0.08367593565359072 0.02877052817684292 0.28140090494640624 0.06700348012554541 0.05568572651126721 0.19289829129121416 0.0007475161992457143 0.9268259509452782 0.16339142134781473 0.48661575224918774 0.16339142134781473 164.30908049925569 34.5809331872731 109.32547807168213 45.571779037831845 152.00957288446125 33.74422284266695 0.5122806353183663 0.1569209423864019 0.04125629187087427 0.017144963702879386 0.11586162500617757 0.04980135461685613 0.03480984437371579 0.020603328666024174 0.02379815335291759 0.01340663580142446 0.03387246974681185 0.014160677538799784 43665 |TCGA-EJ-5509-01A-01-BS1_ROI.svs- saveMacro Can't Read 'macro' Image from Slide's Associated Images
#dataset:filename comments image_bounding_box base_mag type levels height width mpp_x mpp_y comment brightestPixels dark flat_areas fatlike_tissue_removed_num_regions fatlike_tissue_removed_mean_area fatlike_tissue_removed_max_area fatlike_tissue_removed_percent small_tissue_filled_num_regions small_tissue_filled_mean_area small_tissue_filled_max_area small_tissue_filled_percent small_tissue_removed_num_regions small_tissue_removed_mean_area small_tissue_removed_max_area small_tissue_removed_percent background_contrast background_contrast_std background_dissimilarity background_dissimilarity_std background_homogeneity background_homogeneity_std background_ASM background_ASM_std background_energy background_energy_std background_correlation background_correlation_std background_tenenGrad_contrast background_michelson_contrast background_rms_contrast background_grayscale_brightness background_grayscale_brightness_std background_chan1_brightness background_chan1_brightness_std background_chan2_brightness background_chan2_brightness_std background_chan3_brightness background_chan3_brightness_std blurry_removed_num_regions blurry_removed_mean_area blurry_removed_max_area blurry_removed_percent spur_pixels areaThresh template1_MSE_hist template2_MSE_hist template3_MSE_hist template4_MSE_hist final_contrast final_contrast_std final_dissimilarity final_dissimilarity_std final_homogeneity final_homogeneity_std final_ASM final_ASM_std final_energy final_energy_std final_correlation final_correlation_std tenenGrad_contrast michelson_contrast rms_contrast grayscale_brightness grayscale_brightness_std chan1_brightness chan1_brightness_std chan2_brightness chan2_brightness_std chan3_brightness chan3_brightness_std chan1_brightness_YUV chan1_brightness_std_YUV chan2_brightness_YUV chan2_brightness_std_YUV chan3_brightness_YUV chan3_brightness_std_YUV deconv_c0_mean deconv_c0_std deconv_c1_mean deconv_c1_std deconv_c2_mean deconv_c2_std #pieces_of_tissue pixels_to_use warnings
TCGA-EJ-5509-01A-01-BS1_ROI.svs (0, 0, 4092, 4092) 20.0 aperio 1 4092 4092 0.50149999999999995 0.50149999999999995 Aperio Fake |AppMag = 20|MPP = 0.5015 0.2487945556640625 0.0063374702931080495 0.006582309532083608 0 0 0 0.0 165 1.8909090909090909 15 -0.006420149391937802 1 10.0 10 0.00020446134658247406 1.0098250225817402 1.6726571860607253 0.2528666764200787 0.4252018475618517 0.9337698968400423 0.1142845916582232 0.8404324661847189 0.2749993733706908 0.897567529038673 0.18656097394720528 0.5999317010355991 0.4234307078840679 9.538838020360488e-06 0.9268259509452782 0.18247882870888657 0.9186934437180535 0.005377040601787484 235.76269760173108 1.3349606666359373 233.56590731502072 1.473921948906114 236.81282683176053 0.9182862023596723 3 1744.6666666666667 4915 0.10703695372093502 0.0 0.0 0.0005713989005378889 0.00210218250820665 0.00037149510237524463 0.0022534729516800454 2.4557276884185666 1.068922962978307 1.1239287111502159 0.3038952269197558 0.529846271258571 0.10999022358426115 0.08367593565359072 0.02877052817684292 0.28140090494640624 0.06700348012554541 0.05568572651126721 0.19289829129121416 0.0007475161992457143 0.9268259509452782 0.16339142134781473 0.48661575224918774 0.16339142134781473 164.30908049925569 34.5809331872731 109.32547807168213 45.571779037831845 152.00957288446125 33.74422284266695 0.5122806353183663 0.1569209423864019 0.04125629187087427 0.017144963702879386 0.11586162500617757 0.04980135461685613 0.03480984437371579 0.020603328666024174 0.02379815335291759 0.01340663580142446 0.03387246974681185 0.014160677538799784 1 43665 |TCGA-EJ-5509-01A-01-BS1_ROI.svs- saveMacro Can't Read 'macro' Image from Slide's Associated Images
6 changes: 3 additions & 3 deletions histoqc/tests/test_images_tsv_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,10 @@ def setUp(self):

# tsv
self.rs_name = "results.tsv"
# tsv_labels #### '#start_time:',
self.tsv_labels = ['#pipeline:', '#outdir:', '#command_line_args:', '#config_file:', '#dataset:']
# tsv_labels #### '#start_time:', '#outdir:', '#config_file:',
self.tsv_labels = ['#pipeline:', '#command_line_args:', '#dataset:']
# tsv dataset fields
self.tsv_dataset_fields = ['filename','comments','image_bounding_box','base_mag','type','levels','height','width','mpp_x','mpp_y','comment','brightestPixels','dark','flat_areas','fatlike_tissue_removed_num_regions','fatlike_tissue_removed_mean_area','fatlike_tissue_removed_max_area','fatlike_tissue_removed_percent','small_tissue_filled_num_regions','small_tissue_filled_mean_area','small_tissue_filled_max_area','small_tissue_filled_percent','small_tissue_removed_num_regions','small_tissue_removed_mean_area','small_tissue_removed_max_area','small_tissue_removed_percent','background_contrast','background_contrast_std','background_dissimilarity','background_dissimilarity_std','background_homogeneity','background_homogeneity_std','background_ASM','background_ASM_std','background_energy','background_energy_std','background_correlation','background_correlation_std','background_tenenGrad_contrast','background_michelson_contrast','background_rms_contrast','background_grayscale_brightness','background_grayscale_brightness_std','background_chan1_brightness','background_chan1_brightness_std','background_chan2_brightness','background_chan2_brightness_std','background_chan3_brightness','background_chan3_brightness_std','blurry_removed_num_regions','blurry_removed_mean_area','blurry_removed_max_area','blurry_removed_percent','spur_pixels','areaThresh','template1_MSE_hist','template2_MSE_hist','template3_MSE_hist','template4_MSE_hist','final_contrast','final_contrast_std','final_dissimilarity','final_dissimilarity_std','final_homogeneity','final_homogeneity_std','final_ASM','final_ASM_std','final_energy','final_energy_std','final_correlation','final_correlation_std','tenenGrad_contrast','michelson_contrast','rms_contrast','grayscale_brightness','grayscale_brightness_std','chan1_brightness','chan1_brightness_std','chan2_brightness','chan2_brightness_std','chan3_brightness','chan3_brightness_std','chan1_brightness_YUV','chan1_brightness_std_YUV','chan2_brightness_YUV','chan2_brightness_std_YUV','chan3_brightness_YUV','chan3_brightness_std_YUV','deconv_c0_mean','deconv_c0_std','deconv_c1_mean','deconv_c1_std','deconv_c2_mean','deconv_c2_std','pixels_to_use','warnings']
self.tsv_dataset_fields = ['filename','comments','image_bounding_box','base_mag','type','levels','height','width','mpp_x','mpp_y','comment','brightestPixels','dark','flat_areas','fatlike_tissue_removed_num_regions','fatlike_tissue_removed_mean_area','fatlike_tissue_removed_max_area','fatlike_tissue_removed_percent','small_tissue_filled_num_regions','small_tissue_filled_mean_area','small_tissue_filled_max_area','small_tissue_filled_percent','small_tissue_removed_num_regions','small_tissue_removed_mean_area','small_tissue_removed_max_area','small_tissue_removed_percent','background_contrast','background_contrast_std','background_dissimilarity','background_dissimilarity_std','background_homogeneity','background_homogeneity_std','background_ASM','background_ASM_std','background_energy','background_energy_std','background_correlation','background_correlation_std','background_tenenGrad_contrast','background_michelson_contrast','background_rms_contrast','background_grayscale_brightness','background_grayscale_brightness_std','background_chan1_brightness','background_chan1_brightness_std','background_chan2_brightness','background_chan2_brightness_std','background_chan3_brightness','background_chan3_brightness_std','blurry_removed_num_regions','blurry_removed_mean_area','blurry_removed_max_area','blurry_removed_percent','spur_pixels','areaThresh','template1_MSE_hist','template2_MSE_hist','template3_MSE_hist','template4_MSE_hist','final_contrast','final_contrast_std','final_dissimilarity','final_dissimilarity_std','final_homogeneity','final_homogeneity_std','final_ASM','final_ASM_std','final_energy','final_energy_std','final_correlation','final_correlation_std','tenenGrad_contrast','michelson_contrast','rms_contrast','grayscale_brightness','grayscale_brightness_std','chan1_brightness','chan1_brightness_std','chan2_brightness','chan2_brightness_std','chan3_brightness','chan3_brightness_std','chan1_brightness_YUV','chan1_brightness_std_YUV','chan2_brightness_YUV','chan2_brightness_std_YUV','chan3_brightness_YUV','chan3_brightness_std_YUV','deconv_c0_mean','deconv_c0_std','deconv_c1_mean','deconv_c1_std','deconv_c2_mean','deconv_c2_std','#pieces_of_tissue','pixels_to_use','warnings']

def tearDown(self):
del self.suffixes
Expand Down

0 comments on commit d002b2d

Please sign in to comment.