Reshape error and problems saving

For reference, I have been saving my files as Amira mesh binary RLE compression SLOW (*.am). I have not had the same problems when saving as .model. However, when the .model file is saved as a compressed Amira file (file>save model as) the problem occurs again. (I need to save the file as a compressed Amira file in order to share it.)

My issue started a few days ago when I tried to load a model I had been working on. Instead of loading, the program froze and when I clicked out of the loading window, this error: “Error using reshape To RESHAPE the number of elements must not change” showed up in red.

I opened the model in Amira and manually changed the coordinates and voxel sizes to match the image dataset. I saved the model in Amira and was able to open in MIB and work on it for the rest of the day. However, when I tried to open that file the next day I got the same “reshape” error. I fixed it in the same way (adjusting coordinates and voxel sizes) in Amira, but had the same error again today.

I’ve now been trying to open previous versions of this model saved on my computer and they all have the same error. In later versions of the model, there’s one frame in the z stack that has been deleted and only contains what had been worked on that day (all other labels were missing on that frame).There are two earlier versions of the model are able to open in MIB. However after saving (file>save file as) they no longer work.

I’ve tried downloading earlier versions of the model saved in the cloud. An even more unusual problem occurred. Every version of this model that I download is seemingly ‘converted’ into the first version of the model that started showing the reshape error - when I open these files in Amira they all have the same segmentation and they download as the same size (29,522mb) as the original error file regardless of the size of the file I’m downloading (between 26.2-28.8mb).

I’m at a loss at the moment. I’m not sure if this is an error in saving, an error in downloading, if files are being overwritten or edited in these processes? I don’t know if these are all separate issues that happened at the same time or related issues.

Any help would be appreciated.

Hi,
I would not recommend RLE comression in MIB - the procedure was not optimized and because of that extremely slow. My solution is to open the file in Amira and save it from there, it comes with RLE compression in this case by default. The RLE-compressed files can be opened in MIB quite normally. Alternative solution is to zip the saved uncompressed AM file for sharing.
So if you used AM with RLE. try to check uncompressed AM.

In which format do you keep your model files during the work? I recommend to keep it in the Matlab *.model format and whenever is needed export in AM or any other type. There are certain limitations in AM-format and because of that the MODEL format is preferable.
Would you be able to share those models with me, I can take a look or we can set a zoom/skype meeting to sort that out.

Ilya

Hi Ilya,

I tried opening the .model file that I have and saving it as an uncompressed AM in MIB and that seemed to be able to open again. I just started working on this
project, but from what I understand they have been saving all their models as RLE compression files for months without a problem. Even on my computer, all other models saved as RLE compression are fine, it’s just this file for the past couple days that has
been having issues.

Thank you,

Cecilia

image002.jpg

Hi Cecilia,
try to minimize use of RLE compression - it takes ~years to save models in this format.
Also, I recall, that there were some recent changes in the AM format (probably related to Amira 2019.2 release) and I had to modify the reading procedures. If you are using MIB with Matlab, I can send you those updated files. Otherwise, there will an update of MIB with the fix.
Ilya

Hi Ilya,

I am using MIB with Matlab. If you could send the updated files that would be great.

It seems that saving the files as either .model or uncompressed .am allows me to access the files in the meantime until the problem can be fixed.

I can talk to my supervisor about potentially setting up a meeting time and the practicality of switching to saving as .model or uncompressed amira.

Thank you,
Cecilia

make a copy of amiraMesh2bitmap.m and getAmiraMeshHeader.m from MIB\ImportExportTools\Amira directory. After that copy there the attached files.

amiraMesh2bitmap.m (11.9 KB) getAmiraMeshHeader.m (9.1 KB)

I copied the files in, but now when I save the model after editing, I got this error:

Output argument “par” (and maybe others) not assigned during call to “getAmiraMeshHeader”.

Error in mibController/mibLoadModelBtn_Callback (line 125)
[~, img_info] = getAmiraMeshHeader(fullfile([path filename{fnId}]));

Error in mibGUI>menuModelsLoad_Callback (line 1883)
handles.mibController.mibLoadModelBtn_Callback();

Error in gui_mainfcn (line 95)
feval(varargin{:});

Error in mibGUI (line 42)
gui_mainfcn(gui_State, varargin{:});

Error in matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)mibGUI(‘menuModelsLoad_Callback’,hObject,eventdata,guidata(hObject))

Error while evaluating Menu Callback.

I have copied my original versions of the files back in and it is back to the original reshape error.

I checked, indeed there are significant changes in menuModelsLoad_Callback function that are causing the problem. I will send you the whole package to test.