-
Notifications
You must be signed in to change notification settings - Fork 25
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
Example Dataset #685
Example Dataset #685
Conversation
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
Here is the current structure after downloading the example dataset and running through Notebook 1. data/
└── example_dataset/
├── image_data/input_data/
│ ├── fov0/
│ │ ├── CD3.tiff
│ │ ├── CD4.tiff
│ │ ├── ...
│ │ └── Vim.tiff
│ ├── ...
│ └── fov10/
│ ├── CD3.tiff
│ ├── CD4.tiff
│ ├── ...
│ └── Vim.tiff
├── segmentation/
│ ├── deepcell_input/
│ ├── deepcell_output/
│ ├── deepcell_visualization/
│ └── cell_table/
├── pixie/
├── post_clustering/
│ ├── mantis/
│ └── masks/
└── analysis/
├── spatial_enrichment/
└── spatial_lda/
├── processed/
└── visualization/ |
…tuitive), and update notebook tests
Can we have all of the segmentation subfolders at the same level? deepcell_input, deepcell_output, deepcell_visualization, cell_tables. And put all of those in a folder called segmentation instead of processed? And instead of raw, call the folder image_data, so it's exactly the same as toffy, without any subfolders, just the FOV folders |
…_masks, change dtype from int16 to int32
Yes, that’s still an issue.
… On Sep 3, 2022, at 10:10 AM, Noah F. Greenwald ***@***.***> wrote:
@ngreenwald commented on this pull request.
In ark/utils/deepcell_service_utils.py:
> """
float_mask = imread(BytesIO(seg_mask))
# Reshape as ranked_mask returns a 1D numpy array, dims: n^2 x 1 -> 1 x n x n
shape = float_mask.shape
# Create the ranked mask
- ranked_mask: np.ndarray = stats.rankdata(float_mask).astype(dtype="int16").reshape(shape)
+ ranked_mask: np.ndarray = stats.rankdata(float_mask).astype(dtype="int32").reshape(shape)
Right, I get that it removes the size 0 cells, but are there still cell IDs in the millions?
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you commented.
|
@srivarra I did some testing and reading of Main question is why isn't Also wanted to re-verify that the raw segmentation output labels in #609 matched up with the previous version. If that's the case, it could also mean the inherent |
@alex-l-kong Here is the function def _convert_deepcell_seg_masks(seg_mask: bytes) -> np.ndarray:
float_mask = imread(BytesIO(seg_mask))
# Reshape as ranked_mask returns a 1D numpy array, dims: n^2 x 1 -> 1 x n x n
shape = float_mask.shape
# Create the ranked mask
ranked_mask_repr: np.ndarray = stats.rankdata(float_mask, method = "average")
ranked_mask: np.ndarray = ranked_mask_repr.astype(dtype="int32").reshape(shape)
return ranked_mask Consider the rudimentary test function below: def test_convert_deepcell_seg_masks():
with tempfile.TemporaryDirectory() as temp_dir:
test_mask = np.zeros((10,10))
test_mask[0,0] = 1
test_mask[0,1] = 2
test_mask[0,2] = 2
tifffile.imwrite(f"{temp_dir}/test_mask.tiff", data = test_mask)
with open(f"{temp_dir}/test_mask.tiff", 'r+b') as test_mask_bytes:
print(_convert_deepcell_seg_masks(test_mask_bytes.read())) We can adjust the For
For
For
Dense looks like what we want. It is the same algorithm as If we change the test data to be a random matrix of integers like below: ....
# Initialize a new generator - set seed for reproducibility
rng = np.random.default_rng(12345)
test_mask = rng.integers(low = 0, high = 1000, size=(10,10))
.... Then for
Ties will rank the integer values with the same value, as there are 2 instances of |
@srivarra it looks like |
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.
Looks good, just some minor suggestions. Also looks like some extraneous files got added in spatial_enrichment_input_data
…opy data over to ark-analysis/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.
Looks good, just some path changes
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.
Great, looks good
If you haven't already, please read through our contributing guidelines before opening your PR
What is the purpose of this PR?
Closes #657. Adds an example dataset available at Hugging Face.
How did you implement your changes
Added a set of example FOVs in the dataset here.
Remaining issues