ClearAnatomics / ClearMap

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

Bug: inverse transform #110

Closed andrewsilberfeld closed 2 years ago

andrewsilberfeld commented 2 years ago

Hello,

The inverse transform function is missing the lines to automatically count the number of processes when processes term is None:

if processes is None: processes = mp.cpu_count()

also, when those lines are added back to the Elastix.py script and clearmap2 is restarted, Elastix throws an error because it references a file set in Christoph's directory:

Installing all components. InstallingComponents was successful. Error: DisplacementMagnitudePenalty(index 3) - This component is not installed! ERROR: error occurred while creating Metric 0. itk::ExceptionObject (0x2b0f150) Location: "unknown" File: /home/ckirst/Science/Projects/WholeBrainClearing/Vasculature/Analysis/ClearVessel/ClearMap/External/elastix/src/Core/Kernel/elxElastixMain.cxx Line: 819 Description: itk::ERROR: ElastixMain(0x2ac6f10): The following component could not be created: DisplacementMagnitudePenalty

The first error can be fixed by adding the "if processes is None: ..." lines to "inverse_transform()" and restarting clearmap. Not sure how to fix this second error right now.

andrewsilberfeld commented 2 years ago

Pretty sure the the 2nd error "DisplacementMagnitudePenalty(index 3) - This component is not installed!" is due to the initial build of Elastix -- either it lacks that specific file or the file directory is permanently pointed toward a directory on Christoph's machine.

Either way, I decided to install Elastix using CMake on my linux machine and that works well. This can be done by first installing ITK

`module load git/2.35.3 gcc/6.2.0 cmake/3.22.2 #this loads various libraries in my institution's high performance computing cluster. cd /path/to/my/folder/ mkdir itk cd itk git clone https://github.com/InsightSoftwareConsortium/ITK mkdir build cd build cmake ../ITK/ #took 2 min. make -j4 #took 1.5 hours

Install Elastix!

module load git/2.35.3 gcc/6.2.0 cmake/3.22.2 cd /path/to/my/folder/ git clone https://github.com/SuperElastix/elastix.git cd elastix mkdir build cd build cmake .. -DITK_DIR=/path/to/my/folder/itk/build/ make install`