Matlab freezes at certain files when dicomread is used - matlab

This problem is bothering me for a long time and I hope that someone is able to help me. I've searched the internet extensively but it seems that im the only one with this problem.
Occasionally when im loading multiple dicom files into Matlab it freezes at a certain file. Im unable to terminate the script and i have to force matlab to shut down. I do not know if this is a bug but i hope that there is a work-around for this because the dicomread does not return an error but freezes Matlab.
More information:
It happens with multiple datasets from different organisations
It happens with multiple computers
Matlab version 2013b/2014a/2014b
I hope that somebody can help me to fix this or find a workaround.

I had the same problem and I am using Matlab 2014. The same code I have runs fine on Matlab 2012.
I solved the issue by copying the DICOM library from Matlab 2012 to 2014. If you have a Windows machine, the library in the 2012 version is typically installed at
C:\Program Files\MATLAB\R2012a\toolbox\images\iptformats
The 2014 version is at
C:\Program Files\MATLAB\R2014a\toolbox\images\iptformats

Identical problem here with 3D CT scans. I had hundreds of scans stored as dicom folders (1 file per slice) that I converted to dicom volumes (1 file per entire volume) with compression. 6 of them would trigger a segmentation fault in the dicomparse call inside dicomread, despite I had no problem reading them in other software tools.
Twe easiest walkaround for me was to re-export these dicoms as uncompressed dicom volumes with a different software tool.

Related

How to extract F2FS file system based disk img files?

I am writing a program in windows (C#) to extract disk images from AOSP. I am using simg2img, but to no avail. Simg2img only supports EXT4 based file systems and some of my IMG files are written in F2FS. How do I extract these files? I have been struck with this problem for weeks if anyone can give any direction it would be helpful!

MATLAB cannot save changes to the path

When starting Matlab, I must now add new paths in order to get access to my functions. However, these paths cannot be saved, and I get the following message:
“MATLAB cannot save changes to the path.
The path file, pathdef.m, might be read-only or might be in a directory for which you do not have write access.
You can save pathdef.m to a different location. In order for MATLAB to use the pathdef.m in future sessions, you need to save it in your MATLAB startup directory (the directory from which you start MATLAB).
Do you want to save pathdef.m to another location?”
Before that, it works perfectly fine.
I tried the following solutions, but none of them did work:
restart the computer
restart Matlab
start Matlab as Administrator
re-install Matlab
re-install Matlab directly in C:\ (not in C:\Programs)
share Matlab-folders
check the number of „pathdef.m“ (and there is only one)
change UAC to the smallest level
try another license
The problem seems to be between Windows and Matlab. I have Windows 8.1 Pro (64-bit), and I used Matlab 2015a.
Any help to solve the problem would be much appreciated!

How to edit "mexopt.bat" file in Matlab?

I have Matlab R2014b and OpenCV 2.4, i have been trying to use ViolaJones Face Detection toolbox, but i have some troubles. I've searhced the problem and found a solution that suggest edit mexopt.bat file. What the real problem is here
The Matlab command
fullfile(prefdir, 'mexopts.bat')
returns
C:\Users\simit\AppData\Roaming\MathWorks\MATLAB\R2014b\mexopts.bat
but I can't find the file when I go to the path. How can I find the mexopts.bat file and edit it?
I have R2015b installed. I searched my computer for a mexopts.bat file, and found it in folders related to code I have from 2012-2013, but not in the new MATLAB install folder. For this reason I believe it's not a part of the standard MATLAB installation, which is probably why you didn't find it.
According to this thread it seems that the mexopts.bat file is no longer used in MATLAB starting R2014a, and instead you should look for these files:
mex_C_win32.xml
mex_C_win64.xml
MBUILD_C_win32.xml
MBUILD_C_win64.xml
If you are still convinced that you should find and edit a mexopts file, let me recommend you the Everything Search Engine to look for files on your hard-drive.

MATLAB used up all my disk space! How can I get it back?

I left MATLAB running on a simple ode45 + plot, and when I came back I saw that the 5GBs of free space I had on my drive (C:) was no more! MATLAB had stopped due to "no memory".
Can someone please tell me what happened and how I can get my space back???
Thank You.
You can visually inspect hard disk usage and find folders and files which take up a lot of space with a tool such as TreeSize Free.
P.S. You can also try clearing temporary folders either trough built-in disk cleaner or other tools such as CCleaner.
MatLab is one of those apps that have an all world of computing science where you only want to work in a small tiny island of knowledge, the Help folder of it is huge, anyway here's some things you can do to make it slimmer on disk:
Install only the packages you need.
Use JPEGMini to compress the JPEG collection of the huge help folder.
Use Pngyu to compress the huge collection of PNG files to 8 bit depth.
Step 2 and 3 will get you back like a Gigabyte if not more.
Use NTFS compression on the MatLab Folder.
It will get you back another 2 Gigabytes
Both step 2 and 3 must be done with admin privileges, the drag and drop of folder to it must be done with another app with admin privileges also, you can use Explorer++ as Windows File Explorer alternative.

MATLAB slowing down on long debugging sessions

I have noticed that MATLAB (R2011b on Windows 7, 64 bit) tends to slow down if I am in debugging mode for a long period of time (e.g. 3 hours). I don't recall this happening on previous versions of MATLAB.
The slow down is small, but significant enough to have an impact on my productivity (sometimes MATLAB needs to wait for up to 1 sec before I can type on the command line or on the editor).
I usually spend hours on debugging mode (e.g. after stopping at a keyboard statement) coding full projects in this mode. I find working on debugging mode convenient to organically grow my code while inspecting my code anytime in execution time.
The odd thing is my machine has 16 GB of RAM and the total size of all workspaces while in debugging mode is usually less than 4 GB. I don't have any other large process running in the background, and my system reports ~8GB of free RAM.
Also, unfortunately MATLAB does not let me call pack from debugging mode; it complains with :
Warning: PACK can only be used from the MATLAB command line.
I have reproduced this behavior after restarting MATLAB, rebooting my system, and on different days. With this, my question/s are:
Has anybody else noticed this? Is there anything I could do to prevent this slowdown without exiting debugging mode?
Are there any technical notes or statements from Mathworks addressing this issue?
In case it matters, my code is on a network drive, so I added the following on my startup.m file, which should alleviate any impact on performance resulting from it:
system_dependent('RemoteCWDPolicy', 'None');
system_dependent('RemotePathPolicy', 'None');
system_dependent('DirChangeHandleWarn','Never');
I have experienced some similar issues. The problem ended up being that Mathworks changed how Matlab caches files. For some users, it is now storing data in the TMP folder as defined by the environment variables. This folder was being scanned by anti virus and causing a lot of performance problem. Of course, IT wouldn't let us exclude the TMP folder from scans. So we added a line to our start up script that changes the environment variable of TMP to some other location within an excluded folder.
You don't have to worry about changing the variable back or messing up other programs. When applications launch, they copy the environment variables into their own local instance of them. Any changes made to them only change the local copy of those variables, not the system copy.
Here is the function you will need.
setenv('TEMP', 'C:\TEMP');
I'm not sure if it was TMP or TEMP. Check your environment variables to be sure.
I am using MATLAB R2011 on linux 10, windows 7 (32 bit).
I experienced MATLAB slowing down while printing simple variables in command window.
It turned that there was one .m file loaded in my Editor.
It was a big file with 10000 lines. These lines were simple data that should have been saved as mat file. When i closed this file, the editor was back to its normal speed.