ClearAnatomics / ClearMap

ClearMap 2 with WobblyStitcher, TubeMap and CellMap
https://clearanatomics.github.io/ClearMapDocumentation/
GNU General Public License v3.0
109 stars 46 forks source link

GUI: Alignment Issue #123

Closed cardinger closed 1 year ago

cardinger commented 1 year ago

I am using ClearMap2.1 with the ClearMapUi39 environment.

I am having a lot of trouble getting the autofluorescence to align to the cFOS images (see video below). In the GUI, under alignment > atlas registration > run registration > I am using the "use resampled landmarks" feature and putting ~25 landmarks throughout the z-stack on each of the series of images. I have tried running this a few times, and no matter how I set up or distribute the landmarks it does not seem to make a difference. Each time the result file (when looking at the "autoflurorescence to data" under display results - which is what is shown in the video) is flattened and does not align. Do you have any advice? The "reference to autoflurorescence" results to not have this issue. Those results look good.

Thanks - Screencast from 05-30-2023 07:42:16 PM.webm

crousseau commented 1 year ago

Before optimising with landmarks, I would first check that the automated alignment gives a reasonable result. Since you are using the dev version, you are missing the button to revert from landmarks based to automated (whch already exists in the test branch). What you can do is remove the .pts files in the elastix subfolders of your sample folder. Also, the kind of result yo get could be expected if your orientation, resolution or crop parameters are erroneous, please check those before trying again.

cardinger commented 1 year ago

Removing the .pts files and fixing a typo in the resolution has helped. Thanks!

If you have time for one more question - is there an easy way to export the cell counts labeled by brain region from the GUI? I don't see an option like this under the Cellmap tab, but maybe it is somewhere else?

Screencast from 05-31-2023 12:54:37 PM.webm

crousseau commented 1 year ago

After running the cell detection, there should be 2 new files. a cells.feather file which is a binary table format with one line per cell and a .csv file where there is only the total number of cell for each brain region (x2 because they are split by hemisphere). The .feather format was chosen for performance reasons because a text format like csv is not suited for millions of points

cardinger commented 1 year ago

Thanks!

I see the cells.feather file. However, I do not see the .csv.

When I run the cell detection, I get this error:

File "/home/lapishla/miniconda3/envs/ClearMapUi39/lib/python3.9/site-packages/ClearMap2-2.1.0-py3.9-linux-x86_64.egg/ClearMap/gui/tabs.py", line 627, in run_cell_map self.cell_detector.post_process_cells() # FIXME: save cfg and use progress File "/home/lapishla/miniconda3/envs/ClearMapUi39/lib/python3.9/site-packages/ClearMap2-2.1.0-py3.9-linux-x86_64.egg/ClearMap/processors/cell_map.py", line 126, in post_process_cells self.export_collapsed_stats() File "/home/lapishla/miniconda3/envs/ClearMapUi39/lib/python3.9/site-packages/ClearMap2-2.1.0-py3.9-linux-x86_64.egg/ClearMap/processors/cell_map.py", line 371, in export_collapsed_stats tmp['Structure order'] = grouped['order'].first() File "/home/lapishla/miniconda3/envs/ClearMapUi39/lib/python3.9/site-packages/pandas/core/frame.py", line 3950, in __setitem__ self._set_item_frame_value(key, value) File "/home/lapishla/miniconda3/envs/ClearMapUi39/lib/python3.9/site-packages/pandas/core/frame.py", line 4104, in _set_item_frame_value raise ValueError( ValueError: Cannot set a DataFrame with multiple columns to the single column Structure order

I see there is a comment in there: # FIXME: save cfg and use progress - are there any updates which have fixed this issue? I believe this is why I am missing the .csv. Thanks again