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

DEGA-178-image-quantification #58

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

jaspreetishar
Copy link
Contributor

No description provided.

@jaspreetishar jaspreetishar marked this pull request as ready for review February 5, 2025 16:14
plt.figure(figsize=(10, 10))
plt.imshow(stain_image_with_contrast, cmap='gray')
plt.title(f"Stain Image with Contrast Factor {contrast_factor}")
plt.show()
Copy link
Contributor

Choose a reason for hiding this comment

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

I saw a few plt.show() in this file. If it is standard QC results plot, it is better to write to a file. If this function is called multiple time, you may want to consider skipping the plt.show() with `plt.close() or add a bool argument to switch on/off displaying plot.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

During the optional contrast adjustment process, the displayed plots are only for checking whether the contrast level for the image is sufficient or not. And the data used to create the plots that have the stained image and the stain-positive cells overlaid on them is saved in a .csv file as well. Do you think it's required to save these plots separately? If you think it is better to save them too, I can add that line of code. Also, I have used plt.close() wherever needed


return f"{base_path}/contrast_adjusted_stain_image.tif"

def process_inputs_for_quantification(technology_name, cell_boundary_file, image_file, transform_file, base_path, image_contrast_required=False, contrast_factor=5, intensity_threshold=100):
Copy link
Contributor

Choose a reason for hiding this comment

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

Some docstring below the function name can be very helpful here.

cell_polygons["mean_intensity_EdU"] = intensities
cell_polygons["sum_intensity_EdU"] = sum_intensities

log_transformed_EdU_intensities = np.log1p(cell_polygons['sum_intensity_EdU'])
Copy link
Contributor

Choose a reason for hiding this comment

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

Why log1p is used here and not other normalization methods?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I used log1p normalization because the image data I was working with had very low intensities for a specific stain, making the distribution highly skewed. I chose log1p to reduce the impact of extreme values and bring the data closer to a normal distribution. Do you think this is the right normalization method? If so, do you have any suggestions for a better normalization method?


print("Filtered stain positive cells data (.csv) saved. Filtering done.")

def image_quantification(base_path, technology_name, image_contrast_required=False):
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you have an example notebook or something that showcases this function? Would like to see an example. Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just sent you an example notebook and an example dataset!

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.

2 participants