Quantcast
Channel: Latest Discussions - COMSOL Forums
Viewing all articles
Browse latest Browse all 428

1GB MPH file resulting from importing a 4KB Image via MPHIMAGE2GEOM... Why?!

$
0
0
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;

Viewing all articles
Browse latest Browse all 428

Trending Articles