-
Notifications
You must be signed in to change notification settings - Fork 3
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
How do I get the stat files? #51
Comments
Hi @SaibotMagd, great question! Those files are output to the atlas folder when running atlas import with smoothing on, but they're not currently generating when running the watershed-based smoothing ( Thanks for pointing this out! |
I've added a branch/PR that outputs smoothing stats now during the eroding/smoothing step. Let me know if it works for you! |
Thanks again! I think its best to print the stats as default. |
Thanks for testing this! I've updated the PR to output the |
Mistake on my terms. I'm sorry. |
Thanks for testing and the stack trace. Hm, haven't seen this one before and curious that it works in one orientation but not the other. Are you running this on 2D planes? Do you have any sample files I could try to reproduce this error? I pushed an update that fixes another issue with |
I think the mistake was on my side. It seems like it is impossible to do the "make_edge_images" step using images from different directions after another without deleting the files created before. Now it's working. Now i have to try to understand the meaning of the statistics. So #45 is now becoming more and more pressing. |
Sounds good, no problem. Yes, the
I agree that the coronal segmentations look quite smooth as-is. I may still be a bit confused about your exact setup, trying to understand why the horizontal vs coronal refinements give different outputs since the refinement (and DSC) works in 3D and should give the same output whether the input is given coronally or horizontally (though I have mainly tested atlases given in one orientation). Or are you doing successive 2D plane refinements on either 2D coronal or 2D horizontal planes rather than inputting a single 3D volume? The DSC could be a way to compare the atlas outputs. The DSC output saved in the file just compares the foreground of the intensity image and aggregate labels, while the command-line output also shows the DSC of the original to refined labels to show how much the refinement has changed the labels (though not necessarily the quality of those changes). If you want to measure the quality of the refinement compared with histological boundaries, you could use the
|
I posted a PR (#57) that fixes the atlas-to-labels DSC to use the new rather than the original labels image and also saves the label-to-labels DSC rather than just printing them to console. |
This seems not to work for me: `
I'm curious: What's the difference between the "--img $folder" parameter and the imagecall without the "--img" flag: "run.py atlasVolume.nii"? |
Update: |
I made
Glad it works now! The I just posted a PR (#61) so that you can use a flat CSV file like the I've also been working on a document for all the command line flags to summarize them and hopefully make things easier. It's a work in progress so let me know if you have any suggestions for it (and feel free to edit/PR)! https://github.com/sanderslab/magellanmapper/blob/master/docs/cli.md |
What does it mean "it's been registered"? Yes I registered the annotations to my ls-image, but I never did this with magellan only external.
I tried this but it isn't working, at least for a 2D image. I create a csv file only consisting of the regions in this particular image (np.unique). I also tried to copy the other columns from the regions_ids.csv, so it looks like: This is the error log:
|
The registration outputs paths to specific filenames, eg Is your folder structure like this?
This should also work since I made a special case for files in the ABA convention. You can give the folder path as the img argument, and it should find the associated labels image file. The log output should also show where it's looking for files in case it doesn't find it, and you can move it there.
The CSV file looks good. Volume stats with the CSV version doesn't follow label hierarchies yet, so something I'll need to add. The error looks like what I got before. Did you try it on the PR's branch ( |
I'm sorry, I don't understand what that means.
Yes that's how it is. + region_ids.csv , just to be sure: the 3 columns on the right are "fakes", I just copied them from ADMBA-E18pt5/region_ids.csv and added my grey-values in the first column.
Yes the error message mention something about the ABA atlas template. But what does this have to do with the calculation of the intensity values? Could it be that he try to find an ID for a particular grey-value in the ABA atlas, because my annotation-file doesn't share all of the grey-values from the ABA atlas because it isn't a regular mouse ;). So probably he can not find a label for a grey-value?
I'm totally new with all the git branch, pull request stuff, so I missed that. But now I tried it also using the new branch. So the error-log changed a little bit:
|
No worries! Thanks for trying the new branch. The error still looks like the old one though. The error is showing that the file wasn't loaded because it's treating it as a JSON file, which the new branch updates to detect CSV files. If you do
By "grey-values," do you mean the label integer values in your annotations image? The region IDs column is used to list the label integer-defined regions to extract from the annotations/labels image (not the intensity image). Is that what you were referring to?
The "registered images" expects an atlas folder structure like this:
So the base path can be given as the Your folder structure is slightly different, where the base path is a folder, and |
Sorry for my late answer, I'm facing some very serious issues regarding other parts of my pipeline.
Refering to "atlasVolume" in my post before was a mistake. It should be "annotations". So every grey-value in the annotation file refer to one ID from the csv-label file. And there're 100% identical in each region. On the other hand in the "atlasVolume" File the grey-values in a particular region aren't homogenious and do not match the IDs from the label-file. So it was a spelling mistake. |
Sounds good. I've merged in PR #61 so that it's on the main branch now. I've also opened #67 (now merged) with additional updates to volume stats such as merging in the region names automatically and support for hierarchical labels loaded from CSV files, if that's relevant. Feel free to suggest any other stats that might be worth measuring and integrating to optimize your results. Hope this helps. |
After doing "--register vol_stats" on the ABA_25um_atlas I got this output:
"_volumes.csv" exists, but neither "vols_by_sample.csv" nor "vols_by_sample_summary.csv" can be found. |
I tried to run '--vol_stats' on the E11pt5-Dataset from https://search.kg.ebrains.eu/instances/Project/b8a8e2d3-4787-45f2-b010-589948c33f20 and got this error:
|
I think this needs another slash in
The "vols_by_sample.csv" and "vols_by_sample_summary.csv" files actually get output to the current working directory, whereas the "_volumes.csv" file is output to the atlas directory. "vols_by_sample.csv" and "_volumes.csv" are the same here, but "vols_by_sample.csv" includes all atlases when running vol_stats on multiple atlases at the same time. Do you see those files in the working directory? Thanks and hope that helps! |
I found the "vol_by_sample.csv" and "vols_bz_sample_summary.csv" in my home directory, so I think I messed up the "find file command". But either way the content of these files don't help at all. I still don't know the command to calculate the DSC and intensity metrics. So I called the "meas_dice" function right from atlas_stats.py on every label mask by hand, but the result is poor. Also tried to calculate the intensity values and weight them using the label-annotation sizes. But the results are to bad to use them. I renamed the region_id file again but it isn't working:
|
This reminds of the error fixed in #61, now updated on the main branch, so maybe that will fix it?
I'm sorry that the stats aren't working out for you. Perhaps we can discuss this more to see what results you're getting and how to troubleshoot. |
Excellent! Glad it worked out, and thanks for reporting your steps on how to make this work. I'll definitely need to add this into the docs. Thanks for all your help with this! |
Hi,
I can't find a way to create the stat files for the label-eroding & smoothing step on my data. I'm looking for the files created in the basic protocol (I don't know which step but I only did everything till protocol 5)
When I rerun the protocol 5 they won't be recreate.
I only get the markers.csv. So how can I get them?
The text was updated successfully, but these errors were encountered: