Discussion Closed This discussion was created more than 6 months ago and has been closed. To start a new discussion with a link back to this one, click here.
1GB MPH file resulting from importing a 4KB Image via MPHIMAGE2GEOM... Why?!
Posted 26 apr 2016, 23:54 GMT-4 Interfacing, LiveLink for MATLAB, Geometry, Modeling Tools & Definitions Version 5.1 1 Reply
Please login with a confirmed email address before reporting spam
We are trying to import the attached small image into COMSOL using the mphimage2geom command in Matlab Livelink (relevant piece of code is below for your reference). The resulting mph file is over 1GB large, and takes forever to write. What is the cause of the huge file size, and how to avoid this?
COMSOL techsupport recommended importing the image using Functions>Image, and then "it will behave like a function". So does this mean that MPHIMAGE2GEOM is useless? Or am I using it in the wrong way somehow? Please explain...
Thanks.
-------------------------------------CODE BELOW-------------------------------------------------------
L = bwlabel(bw_image);
total_objects_number = max(unique(L)); %get the number of cells
for this_object_number = 1:total_objects_number
this_bw_object = L == this_object_number; %select THIS cell from GROUP of cells
%% obtain COMSOL geometry from image
img_geometry_MODEL_tag = ['Cell_' num2str(this_object_number)];
image_2_geom = mphimage2geom(this_bw_object,1,'Modeltag',img_geometry_MODEL_tag);
%INSERT this cell's COMSOL Geometry into the COMSOL model
model.geom('geom1').insertSequence(img_geometry_MODEL_tag,'geom1');
end
model.geom('geom1').run;
COMSOL techsupport recommended importing the image using Functions>Image, and then "it will behave like a function". So does this mean that MPHIMAGE2GEOM is useless? Or am I using it in the wrong way somehow? Please explain...
Thanks.
-------------------------------------CODE BELOW-------------------------------------------------------
L = bwlabel(bw_image);
total_objects_number = max(unique(L)); %get the number of cells
for this_object_number = 1:total_objects_number
this_bw_object = L == this_object_number; %select THIS cell from GROUP of cells
%% obtain COMSOL geometry from image
img_geometry_MODEL_tag = ['Cell_' num2str(this_object_number)];
image_2_geom = mphimage2geom(this_bw_object,1,'Modeltag',img_geometry_MODEL_tag);
%INSERT this cell's COMSOL Geometry into the COMSOL model
model.geom('geom1').insertSequence(img_geometry_MODEL_tag,'geom1');
end
model.geom('geom1').run;
Attachments:
1 Reply Last Post 2 mag 2016, 06:32 GMT-4