Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove .tif/.tiff extension from list_files for MIBItiff reading in Segment_Image_Data.ipynb #281

Merged
merged 24 commits into from
Oct 27, 2020

Conversation

alex-l-kong
Copy link
Contributor

@alex-l-kong alex-l-kong commented Oct 16, 2020

What is the purpose of this PR?

A mini-PR that addresses and closes #279. By extension, addresses and closes #278.

How did you implement your changes

We simply add a call to extract_delimited_names in io_utils to fix this.

@alex-l-kong alex-l-kong self-assigned this Oct 16, 2020
@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@alex-l-kong
Copy link
Contributor Author

We still may need to address other locations where we need to remove extensions.

Copy link
Member

@ngreenwald ngreenwald left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I mentioned in my comment on the issue, this will fail because FOVs needs to have the .tiff extension for loading mibi-tiff files.
You should change the mibi-tiff flag to be true while making these changes to make sure we fix it

Copy link
Member

@ngreenwald ngreenwald left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than adding more stuff to the notebook, we could probably put this in the deepcell function itself. For example, this exact cleanup already happens if FOVs are set to None:

fovs = io_utils.extract_delimited_names(tifs, delimiter='.')

@alex-l-kong
Copy link
Contributor Author

Rather than adding more stuff to the notebook, we could probably put this in the deepcell function itself. For example, this exact cleanup already happens if FOVs are set to None:

fovs = io_utils.extract_delimited_names(tifs, delimiter='.')

Oh wow, totally forgot about that. Let's do that instead.

@alex-l-kong
Copy link
Contributor Author

I'm not a huge fan of the logic I'm using to handle the removal of the .tif extension and the verification of all the fovs in deepcell_input_dir, so would definitely appreciate a review on that.

Copy link
Member

@ngreenwald ngreenwald left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a bit messy, but I think it gets the job done. I think 2 things would help:

  1. A few comments describing what's going on
  2. A test case for input names with/without extension to make sure it handles properly

Copy link
Member

@ngreenwald ngreenwald left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few typos. We'll see if @vacuousplanet has any additional comments about how to handle the file suffixes

ark/utils/deepcell_service_utils_test.py Outdated Show resolved Hide resolved
ark/utils/deepcell_service_utils_test.py Outdated Show resolved Hide resolved
alex-l-kong and others added 4 commits October 23, 2020 16:48
Co-authored-by: Noah Greenwald <noahfgreenwald@gmail.com>
Co-authored-by: Noah Greenwald <noahfgreenwald@gmail.com>
Copy link
Contributor

@ackagel ackagel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, the messiness of this code depends on how tolerant of user input we are. If we mandate fovs have their file extensions (or mandate they don't have them), then the code is much less messy. However, if we keep fovs file-extension agnostic, this 'clean-up' code it about as optimized as it can be imo.

I'm in favor of keeping file-extension agnosticism, in the hopes of a cleaner issues page 😉 .

Anyways, just one fix and I think we're gtg here

ark/utils/deepcell_service_utils.py Outdated Show resolved Hide resolved
Copy link
Contributor

@ackagel ackagel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Member

@ngreenwald ngreenwald left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Look good, two small tweaks

ark/utils/deepcell_service_utils.py Outdated Show resolved Hide resolved
ark/utils/deepcell_service_utils_test.py Show resolved Hide resolved
@alex-l-kong alex-l-kong merged commit 19721f3 into master Oct 27, 2020
@alex-l-kong alex-l-kong deleted the tiff_ext branch October 27, 2020 20:33
alex-l-kong added a commit that referenced this pull request Jan 14, 2021
…egment_Image_Data.ipynb (#281)

* Add method to split delimited files from MIBItiff reading

* Need to add the actual file exts to this

* Hacky fix for MIBItiff loading

* See if removing setup.py install fixes the issue we've been having

* Move logic from Segment_Image_Data to deepcell_service_utils

* Better (?) way of handling .tif removing?

* Add comments to create_deepcell_output and add mixed fov name/file list to tests

* Fix typo: existant to existent

Co-authored-by: Noah Greenwald <noahfgreenwald@gmail.com>

* Remove extra slash from comment

Co-authored-by: Noah Greenwald <noahfgreenwald@gmail.com>

* Remove extra check for whether .tif file exists

* Fix typo and make sure we're handling both .tif and .tiff files when verifying fovs in deepcell_input_dir

* Fix comments

* Don't remove .zip file after creation, and make sure to handle mixed case of .tif and .tiff files

* Explicitly print out error message that zip file is being overwritten

Co-authored-by: Noah Greenwald <noahfgreenwald@gmail.com>
y2kbugger pushed a commit that referenced this pull request Jul 29, 2021
…egment_Image_Data.ipynb (#281)

* Add method to split delimited files from MIBItiff reading

* Need to add the actual file exts to this

* Hacky fix for MIBItiff loading

* See if removing setup.py install fixes the issue we've been having

* Move logic from Segment_Image_Data to deepcell_service_utils

* Better (?) way of handling .tif removing?

* Add comments to create_deepcell_output and add mixed fov name/file list to tests

* Fix typo: existant to existent

Co-authored-by: Noah Greenwald <noahfgreenwald@gmail.com>

* Remove extra slash from comment

Co-authored-by: Noah Greenwald <noahfgreenwald@gmail.com>

* Remove extra check for whether .tif file exists

* Fix typo and make sure we're handling both .tif and .tiff files when verifying fovs in deepcell_input_dir

* Fix comments

* Don't remove .zip file after creation, and make sure to handle mixed case of .tif and .tiff files

* Explicitly print out error message that zip file is being overwritten

Co-authored-by: Noah Greenwald <noahfgreenwald@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants