bilayer-containers / bilayers

3 stars 1 forks source link

threshold X jupyter - output folder same as input_images folder has some problem #58

Open rajavishah opened 2 weeks ago

rajavishah commented 2 weeks ago

Describe the bug

If the output and input folders are given same for threshold X jupyter then it reanalyzes the generated_output image again and produces outputs twice.

Have you searched existing issues?

Reproduction

Run the threshold_inference_jupyter_image and keep the value of --save_dir same as --folder

Screenshot

Screenshot 2024-10-15 at 4 06 34 PM

Logs/StackTrace


My Input Image Path:  /bilayers/input_images/example_input_image_output.tiff
/bilayers/threshold.py:54: UserWarning: /bilayers/input_images/example_input_image_output_output.tiff is a low contrast image
  skimage.io.imsave(output_filename, labeled_image)
Output saved to: /bilayers/input_images/example_input_image_output_output.tiff
My Input Image Path:  /bilayers/input_images/newwsr_output.tiff
/bilayers/threshold.py:54: UserWarning: /bilayers/input_images/newwsr_output_output.tiff is a low contrast image
  skimage.io.imsave(output_filename, labeled_image)
Output saved to: /bilayers/input_images/newwsr_output_output.tiff
My Input Image Path:  /bilayers/input_images/newwsr.tif
/bilayers/threshold.py:54: UserWarning: /bilayers/input_images/newwsr_output.tiff is a low contrast image
  skimage.io.imsave(output_filename, labeled_image)
Output saved to: /bilayers/input_images/newwsr_output.tiff
My Input Image Path:  /bilayers/input_images/example_input_image.tiff
/bilayers/threshold.py:54: UserWarning: /bilayers/input_images/example_input_image_output.tiff is a low contrast image
  skimage.io.imsave(output_filename, labeled_image)
Output saved to: /bilayers/input_images/example_input_image_output.tiff
Output saved to: /bilayers/input_images/example_input_image_output_output.tiff
Output saved to: /bilayers/input_images/newwsr_output_output.tiff
Output saved to: /bilayers/input_images/newwsr_output.tiff
Output saved to: /bilayers/input_images/example_input_image_output.tiff

Bilayers Version

0.1

System Info

OS version: Mac OS 14.1

rajavishah commented 2 weeks ago

It is fixed by eliminating the analysis of files with filename _output.

This behavior is also found whilst analyzing images via cellpose algorithm. So, when files named with cp_masks are passed to cellpose algorithm, It doesn't even identify it as a input_image. Following behavior was found when testing 2 files with cellpose algorithm and threshold algorithm.


Testing : threshold after limiting _output from processing [4 test cases] Input: file_names —> hello.tif, xyz_output.tif


Testing : cellpose with file_names that includes cp_masks from processing [4 test cases] Input: file_names —> hello.tif, xyz_cp_masks.tif