-
Notifications
You must be signed in to change notification settings - Fork 1
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
Update contour_utils.py #25
base: main
Are you sure you want to change the base?
Conversation
added get_morphology_PCA function
Using pre-commit and added function description
Returns: | ||
List: PCA values for contours | ||
""" | ||
flat_contour_entire_dataset = [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rename: all_flat_contours
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does it contain and what is its shape?
traj = trajectory_collection.get_trajectory(track_id_num) | ||
|
||
# getting cell contours using active shape model | ||
cell_contours = get_cellTool_contour_points(traj, contour_num_points=contour_num_points) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shape of cell_contours?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#time x #contours? comment
Args: | ||
trajectory_collection (obj): trajectory collection of a dataset | ||
contour_num_points (int): number of landmark contour points | ||
trajectory_threshold (int, optional): _description_. Defaults to 1. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is trajectory threshold? threshold of the length of the trajectories? Users can filter via trajectory collection outside of this function. Not need to add and create high coupling logics.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you prefer if we create a line of code outside before runing pca?
final_contour = np.hstack(flattened_contour) | ||
flat_contour_entire_dataset.append(final_contour) | ||
|
||
countour_entire_dataset = np.concatenate(flat_contour_entire_dataset, axis=0).reshape(-1, 2 * contour_num_points) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
countour_entire_dataset -> all_sctc_contours
FYI
sctc - single cell trajectory collection
sct - single cell trajectory
I will add these conventions to dev details
# getting PCA | ||
pca = PCA(n_components=num_components, svd_solver="full") | ||
|
||
pca_entire = pca.fit_transform(countour_entire_dataset) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pca_entire ->transformed_pca_contour_data
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and this variable is not used by other parts/return value?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually wanted to talk to you more about this. I did talk to Weikang about this and maybe I can explain why he did that here in his main pipeline.
countour_entire_dataset = np.concatenate(flat_contour_entire_dataset, axis=0).reshape(-1, 2 * contour_num_points) | ||
|
||
# getting PCA | ||
pca = PCA(n_components=num_components, svd_solver="full") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pca -> _pca_model
|
||
pca_individual_list = [ | ||
pca.transform( | ||
final_contour.reshape((int(len(final_contour) / (2 * contour_num_points)), 2 * contour_num_points)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please make code more readable
E.g. someVar = (int(len(final_contour) / (2 * contour_num_points))
I need to understand the code within 10 seconds of reading.
What is pca_individual list? It can mean a lot of things, e.g. each PCA principle components, contours after PCA transforms for each trajectory, etc. Improve.
added sct and sctc feature collection along with pca function for sctc features
Adding norm_haralick features
added get_morphology_PCA function