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

30 new export option .csv #58

Merged
merged 7 commits into from
Jul 24, 2024
Merged

30 new export option .csv #58

merged 7 commits into from
Jul 24, 2024

Conversation

RukiyyeE
Copy link
Collaborator

@RukiyyeE RukiyyeE commented Jul 16, 2024

resolves #30

Description

Files can now be exported as CSV files in the same directory through the new "Save Features as .csv" option in the "File" dropdown menu. The files keep their name and get the suffix "_cp_features.csv" added.

Changes

The files cellpose/gui/io.py, cellpose/gui/menus.py, cellpose/io.py were modified.

  • method _save_features_csv(parent) was added which calls save_features_csv(parent.filename) if the dataset is two-dimensional (parent.NZ == 1) to save feature data in a CSV file. Otherwise, it outputs an error message.
  • method save_features_csv(file_name) was created which creates or overwrites a CSV file named filename_cp_features.csv without saving content.
  • a ´Save Features as .csv´button` was added to the dropdown menu.
    • shortcut: Ctrl+C was created for this option.

Testing

The function can be tested by uploading an image and then clicking Save Features as .csv in the File menu.

Notes

Asking the user if they really want to replace the file before removing it could be implemented in another issue.

@RukiyyeE RukiyyeE self-assigned this Jul 16, 2024
Copy link
Collaborator

@mariehartung mariehartung left a comment

Choose a reason for hiding this comment

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

Main Review

Nice implementation! It's great that you were able to implement this so quickly even though you were sick!

Proposed changes

  1. I agree with Jakob, an exception in case of a missing file would be a good idea. As of now, I get an error message if I try to use this feature without a picture loaded:
    image
    This doesn't really affect anything as far as I can see and the user probably won't notice it, but it is not ideal.

  2. I am also not quite happy with the shortcut, but I also can't really think of a better one, since "Ctrl+S" is already taken and "Ctrl+V" bears the same problem... Maybe a combination with Shift might be worth considering?

  3. This was not part of the issue so I won't insist on this, but it might be better to ask if the user wants to replace the file before removing it.

Nitpicks

Some minor changes of comments (see individual comments).

cellpose/gui/io.py Show resolved Hide resolved
cellpose/io.py Show resolved Hide resolved
cellpose/gui/menus.py Outdated Show resolved Hide resolved
cellpose/io.py Outdated Show resolved Hide resolved
@RenzoRichter RenzoRichter added this to the Export features as .csv milestone Jul 17, 2024
@github-actions github-actions bot added size/XXL and removed size/XL labels Jul 20, 2024
mariehartung
mariehartung previously approved these changes Jul 20, 2024
Copy link
Collaborator

@mariehartung mariehartung left a comment

Choose a reason for hiding this comment

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

Approval

Thank you very much for implementing the changes!
Everything works perfectly: The error is displayed if no image is opened and the new shortcut is better and successfully creates a file.

mariehartung
mariehartung approved these changes Jul 22, 2024
Copy link
Collaborator

@NicolasDelgadoL NicolasDelgadoL left a comment

Choose a reason for hiding this comment

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

The button works and creates a file that lands in my Desktop, the appropriate messages are printed when saving a file or when this is not possible. The keyboard shortcut is also functional. Nothing to add, very nice job!!

@RukiyyeE RukiyyeE merged commit 9936b92 into main Jul 24, 2024
2 checks passed
@RukiyyeE RukiyyeE deleted the 30_new_export_option_.csv branch July 24, 2024 13:59
@mariehartung mariehartung mentioned this pull request Aug 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

new export option .csv
5 participants