Skip to content

Commit

Permalink
moved preview QC files to qc subfolder
Browse files Browse the repository at this point in the history
  • Loading branch information
unknown authored and unknown committed Jun 25, 2021
1 parent f9f7d12 commit 86fa659
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 15 deletions.
14 changes: 3 additions & 11 deletions UnMicst.py
Original file line number Diff line number Diff line change
Expand Up @@ -629,6 +629,7 @@ def singleImageInference(image, mode, pmIndex):

if not os.path.exists(args.outputPath):
os.makedirs(args.outputPath)
os.makedirs(args.outputPath + '//qc')

append_kwargs = {
'bigtiff': True,
Expand All @@ -651,8 +652,8 @@ def singleImageInference(image, mode, pmIndex):
skimage.io.imsave(args.outputPath + '//' + fileNamePrefix[0] + '_Probabilities_' + str(dapiChannel) + '.tif',np.uint8(255 * PM),**append_kwargs)
if slice==1:
save_kwargs['append'] = False
skimage.io.imsave(args.outputPath + '//' + fileNamePrefix[0] + '_Preview_' + str(dapiChannel) + '.tif', np.uint8(255 * PM), **save_kwargs)
skimage.io.imsave(args.outputPath + '//' + fileNamePrefix[0] + '_Preview_' + str(dapiChannel) + '.tif', np.uint8(255 * rawI), **append_kwargs)
skimage.io.imsave(args.outputPath + '//qc//' + fileNamePrefix[0] + '_Preview_' + str(dapiChannel) + '.tif', np.uint8(255 * PM), **save_kwargs)
skimage.io.imsave(args.outputPath + '//qc//' + fileNamePrefix[0] + '_Preview_' + str(dapiChannel) + '.tif', np.uint8(255 * rawI), **append_kwargs)
slice = slice + 1

else:
Expand All @@ -668,12 +669,3 @@ def singleImageInference(image, mode, pmIndex):
skimage.io.imsave(args.outputPath + '//' + fileNamePrefix[0] + '_NucleiPM_' + str(dapiChannel) + '.tif',np.uint8(255 * nuclei), **save_kwargs)
del nuclei
UNet2D.singleImageInferenceCleanup()

#aligned output files to reflect ilastik
#outputting all classes as single file
#handles multiple formats including tif, ome.tif, nd2, czi
#selectable models (human nuclei, mouse nuclei, cytoplasm)

#added legacy function to save output files
#append save function to reduce memory footprint
#added --classOrder parameter to specify which class is background, contours, and nuclei respectively
5 changes: 3 additions & 2 deletions UnMicst1-5.py
Original file line number Diff line number Diff line change
Expand Up @@ -808,6 +808,7 @@ def singleImageInference(image, mode, pmIndex):

if not os.path.exists(args.outputPath):
os.makedirs(args.outputPath)
os.makedirs(args.outputPath + '//qc')

append_kwargs = {
'bigtiff': True,
Expand Down Expand Up @@ -835,9 +836,9 @@ def singleImageInference(image, mode, pmIndex):
np.uint8(255 * PM), **append_kwargs)
if slice == 1:
save_kwargs['append'] = False
skimage.io.imsave(args.outputPath + '//' + fileNamePrefix[0] + '_Preview_' + str(dapiChannel) + '.tif',
skimage.io.imsave(args.outputPath + '//qc//' + fileNamePrefix[0] + '_Preview_' + str(dapiChannel) + '.tif',
np.uint8(255 * PM), **save_kwargs)
skimage.io.imsave(args.outputPath + '//' + fileNamePrefix[0] + '_Preview_' + str(dapiChannel) + '.tif',
skimage.io.imsave(args.outputPath + '//qc//' + fileNamePrefix[0] + '_Preview_' + str(dapiChannel) + '.tif',
np.uint8(255 * rawI), **append_kwargs)
slice = slice + 1

Expand Down
5 changes: 3 additions & 2 deletions UnMicst2.py
Original file line number Diff line number Diff line change
Expand Up @@ -788,6 +788,7 @@ def singleImageInference(image, mode, pmIndex):

if not os.path.exists(args.outputPath):
os.makedirs(args.outputPath)
os.makedirs(args.outputPath + '//qc')

append_kwargs = {
'bigtiff': True,
Expand All @@ -810,8 +811,8 @@ def singleImageInference(image, mode, pmIndex):
skimage.io.imsave(args.outputPath + '//' + fileNamePrefix[0] + '_Probabilities_' + str(dapiChannel) + '.tif',np.uint8(255 * PM),**append_kwargs)
if slice==1:
save_kwargs['append'] = False
skimage.io.imsave(args.outputPath + '//' + fileNamePrefix[0] + '_Preview_' + str(dapiChannel) + '.tif', np.uint8(255 * PM), **save_kwargs)
skimage.io.imsave(args.outputPath + '//' + fileNamePrefix[0] + '_Preview_' + str(dapiChannel) + '.tif', np.uint8(255 * rawI), **append_kwargs)
skimage.io.imsave(args.outputPath + '//qc//' + fileNamePrefix[0] + '_Preview_' + str(dapiChannel) + '.tif', np.uint8(255 * PM), **save_kwargs)
skimage.io.imsave(args.outputPath + '//qc//' + fileNamePrefix[0] + '_Preview_' + str(dapiChannel) + '.tif', np.uint8(255 * rawI), **append_kwargs)
slice = slice + 1

else:
Expand Down

0 comments on commit 86fa659

Please sign in to comment.