Error with cs_convert when performing MRI segmentation

Increase the Java heap size:
https://www.mathworks.com/help/matlab/matlab_external/java-heap-memory-preferences.html