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

fix: redundant writes to dataframe #1105 #1106

Conversation

X-TRON404
Copy link
Contributor

I have submitted a pull request to address issue #1105. This entails first establishing a data structure, making modifications to it, and then generating a dataframe—all in a single instance.

@X-TRON404 X-TRON404 changed the title fix: redundant writes to dataframe fix: redundant writes to dataframe #1105 Mar 23, 2024

Gx, Gy = np.gradient(im_intensity)
diffG = np.sqrt(Gx**2 + Gy**2)
cannyG = canny(im_intensity)

for i in range(numLabels):
if rprops[i] is None:
Copy link
Contributor

Choose a reason for hiding this comment

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

@X-TRON404 I think you are missing this statement

@X-TRON404
Copy link
Contributor Author

I've made an update to the section of the code where we initially create the features DataFrame and then modify it by accessing its elements repeatedly. In the improved version, I'm now constructing the features using a native Python data structure first, and then transferring these features to the DataFrame in a single operation. This change has resulted in a performance increase of up to ~75%.

@cooperlab cooperlab requested a review from manthey April 3, 2024 20:11
@manthey manthey merged commit e86bcc5 into DigitalSlideArchive:1105-remove-redundant-access-to-dataframe May 13, 2024
11 checks passed
manthey added a commit that referenced this pull request May 13, 2024
* fix: redundant writes to dataframe

* refac: removed double quotes

* refac: removed unused variables

* fix: acc to latest version of HistomicsTK

* refac: removed unused import

* fix: Area is float in ground truth

* refac: relative import

* fix: rm coordinates from rprops

* fix: ignore rprops if None

* fix: ignore rprops if None

* linting compute_fsd_features.py

* lint compute_gradient_features.py

* lint compute_haralick_features.py

* lint compute_morphometry_features.py

* lint test_feature_extraction.py

* lint: rm conditionals from compute_nuclei_features

* Revert "lint: rm conditionals from compute_nuclei_features"

This reverts commit cd842a0.

* lint: trailing comma and newline

* lint: colon spacing in compute_haralick_features.py

* lint: colon spacing in compute_nuclei_features.py

---------

Co-authored-by: X-TRON404 <[email protected]>
Co-authored-by: Lee Cooper <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants