Note: This discussion is about an older version of the COMSOL Multiphysics® software. The information provided may be out of date.

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.

importing txt file to create geometry in comsol 4.0a

Deepak Chowdary
hi

can i create a geometry by importing coordinate data existing in a text file in comsol4.0a?
suppose i am having (x,y) data in a text file and i want to use this data for creating geometry in comsol4.0a.

thanks in advance

regards
deepak

16 Replies Last Post Jan 19, 2013, 12:54 AM EST
COMSOL Moderator

Hello Deepak Chowdary

Your Discussion has gone 30 days without a reply. If you still need help with COMSOL and have an on-subscription license, please visit our Support Center for help.

If you do not hold an on-subscription license, you may find an answer in another Discussion or in the Knowledge Base.

Posted: 6 years ago Jun 2, 2011, 11:52 AM EDT
Hello,

Just wondering, were you able to find a way to work out this issue? I am wondering the same thing myself.

Thank you!
Hello, Just wondering, were you able to find a way to work out this issue? I am wondering the same thing myself. Thank you!

Jeff Hiller COMSOL Employee
Posted: 6 years ago Jun 2, 2011, 12:00 PM EDT
I suppose that your data represents an elevation at various points in the xy plane, i.e. h(x,y). If so, this is something that is feasible using the parametric surface capabilities introduced at version 4.2. See section entitled "Parametric Surfaces" on this page: www.comsol.com/products/4.2/
I suppose that your data represents an elevation at various points in the xy plane, i.e. h(x,y). If so, this is something that is feasible using the parametric surface capabilities introduced at version 4.2. See section entitled "Parametric Surfaces" on this page: http://www.comsol.com/products/4.2/

Posted: 6 years ago Jun 2, 2011, 12:56 PM EDT
Thank you very much, that sounds like what I am looking for. I hope to begin with V4.2 within the next few days (whenever it reaches me.)

Will 4.2 also have the ability to read images? I have an image with only black and white areas and would like to define different material properties based on the color either through the coordinates, element, or node number or somehow directly through the image itself. Do you know of a way to do this with either 4.1 or 4.2?

I really appreciate the help!

Kelly
Thank you very much, that sounds like what I am looking for. I hope to begin with V4.2 within the next few days (whenever it reaches me.) Will 4.2 also have the ability to read images? I have an image with only black and white areas and would like to define different material properties based on the color either through the coordinates, element, or node number or somehow directly through the image itself. Do you know of a way to do this with either 4.1 or 4.2? I really appreciate the help! Kelly

Jeff Hiller COMSOL Employee
Posted: 6 years ago Jun 2, 2011, 1:11 PM EDT
No, 4.2 does not have this sort of image reading capability, although you would probably be able to implement what you want in Matlab and connect it to your COMSOL Model that way.
No, 4.2 does not have this sort of image reading capability, although you would probably be able to implement what you want in Matlab and connect it to your COMSOL Model that way.

Posted: 6 years ago Jun 2, 2011, 1:24 PM EDT
I am mostly using Livelink right now, with Comsol 4.1 and Matlab R2010a and am stuck trying to finding a way to read in my image or impose it on top of a basic square geometry in the code. I can't seem to find a way to write in a numbering system for the nodes or elements from the image into the code.

I was thinking it could go into the geometry section of the code, possibly listing all of the information on the pixels that are black, or in the material properties, something like:

%model.material('mat1').selection.set(1);

where inside the selection set could instead be a list of numbers. Do either of these sound possible?
I am mostly using Livelink right now, with Comsol 4.1 and Matlab R2010a and am stuck trying to finding a way to read in my image or impose it on top of a basic square geometry in the code. I can't seem to find a way to write in a numbering system for the nodes or elements from the image into the code. I was thinking it could go into the geometry section of the code, possibly listing all of the information on the pixels that are black, or in the material properties, something like: %model.material('mat1').selection.set(1); where inside the selection set could instead be a list of numbers. Do either of these sound possible?

Posted: 6 years ago Feb 16, 2012, 9:59 AM EST

Hello Kelly,

i am trying to import images into comsol. Have you solved the problem already? If yes, could you please share how you managed it with Matlab livelink?

thanks!

Chunyan
Hello Kelly, i am trying to import images into comsol. Have you solved the problem already? If yes, could you please share how you managed it with Matlab livelink? thanks! Chunyan

Jeff Hiller COMSOL Employee
Posted: 6 years ago Feb 16, 2012, 10:27 AM EST
Version 4.2a now includes the capability you were looking for: picture import, see section entitled "Image Import" at this link: www.comsol.com/products/4.2a/ .
Version 4.2a now includes the capability you were looking for: picture import, see section entitled "Image Import" at this link: http://www.comsol.com/products/4.2a/ .

Posted: 6 years ago Feb 17, 2012, 3:53 AM EST
hey Jean,

thanks for the information.

But how is that implemented in COMSOL? I am using COMSOL4.2a now. The choices for importing include mphtxt, mphbin, dxf, asc and another one. It seems that direct importing a jpg or bmp is still not possible.

Chunyan
hey Jean, thanks for the information. But how is that implemented in COMSOL? I am using COMSOL4.2a now. The choices for importing include mphtxt, mphbin, dxf, asc and another one. It seems that direct importing a jpg or bmp is still not possible. Chunyan

Alexander Warning
Posted: 6 years ago Mar 1, 2012, 3:39 PM EST
From the promotional video I see we can import 2D images into COMSOL 4.2a, is it possible to import stacks of 2D images as well? I have several CT scans, it would be good to do simulations on.
From the promotional video I see we can import 2D images into COMSOL 4.2a, is it possible to import stacks of 2D images as well? I have several CT scans, it would be good to do simulations on.

Posted: 6 years ago Mar 1, 2012, 3:50 PM EST
still don't know how to import 2D image directly into COMSOL yet.

But if you have access to Mimics, you can find it from this webpage, www.materialise.com/mimics, you could have stacks of CT scans processed in Mimics and then import into COMSOL. I've tried to use Mimics to compose biofilm structure from OCT images. It was possible to import the generated structure into COMSOL. But I had problem afterwards for other settings.

Wish you good luck!

Chunyan
still don't know how to import 2D image directly into COMSOL yet. But if you have access to Mimics, you can find it from this webpage, http://www.materialise.com/mimics, you could have stacks of CT scans processed in Mimics and then import into COMSOL. I've tried to use Mimics to compose biofilm structure from OCT images. It was possible to import the generated structure into COMSOL. But I had problem afterwards for other settings. Wish you good luck! Chunyan

Posted: 6 years ago Mar 1, 2012, 5:51 PM EST
Hi

normally you need the latest version for that, see the release notes and the doc of v4.2a

--
Good luck
Ivar
Hi normally you need the latest version for that, see the release notes and the doc of v4.2a -- Good luck Ivar

Posted: 5 years ago Jul 5, 2012, 12:08 PM EDT
Hi,

I was able to construct 2D geometry from an MRI images, works quite good. Have you found a solution to using stacks of MRI images ?.

Pranay
Hi, I was able to construct 2D geometry from an MRI images, works quite good. Have you found a solution to using stacks of MRI images ?. Pranay

Posted: 5 years ago Jul 18, 2012, 8:43 AM EDT
hello Alexander,

have you found a way to import an image stack into comsol for further simulation? i have several image stacks and am wondering how to compose 3D geometry and import into comsol for simulation. if there is a way to directly import image stack, the simulation would become much easier.

Regards!

Chunyan
hello Alexander, have you found a way to import an image stack into comsol for further simulation? i have several image stacks and am wondering how to compose 3D geometry and import into comsol for simulation. if there is a way to directly import image stack, the simulation would become much easier. Regards! Chunyan

Saeid Norouzi Apourvari
Posted: 5 years ago Oct 10, 2012, 10:19 PM EDT
Dear Chunyan and Alexander,

Did you find any way to import stacks of 2D images acquired from CT. I have a 3D CT-image of a rock which has been segmented to pore (phase 0) and solid(phase 1) and I need to import it to COMSOL for flow simulation. Would you please let me know if you find a way?

Regards,
saeid
Dear Chunyan and Alexander, Did you find any way to import stacks of 2D images acquired from CT. I have a 3D CT-image of a rock which has been segmented to pore (phase 0) and solid(phase 1) and I need to import it to COMSOL for flow simulation. Would you please let me know if you find a way? Regards, saeid

Posted: 5 years ago Oct 16, 2012, 4:04 AM EDT
hey Saeid,

you may try a software called Mimics to creat geometry, even mesh, from image stack and then import the mesh into COMSOL for simulation. but if there are too many voids in your geometry, you may get problem in COMSOL.

Chunyan :)
hey Saeid, you may try a software called Mimics to creat geometry, even mesh, from image stack and then import the mesh into COMSOL for simulation. but if there are too many voids in your geometry, you may get problem in COMSOL. Chunyan :)

Saeid Norouzi Apourvari
Posted: 5 years ago Jan 19, 2013, 12:54 AM EST
Hello there,

I managed to create a mesh for a 3D segmented image using iso2mesh toolbox. However when I import it to COMSOL I can not select any boundary to assign conditions on. Have you guys found any way to import 3D structure as a geometry into COMSOL 4.2, or later versions? (my structure is a segmented image in .mat format).

Regards,
saeid
Hello there, I managed to create a mesh for a 3D segmented image using iso2mesh toolbox. However when I import it to COMSOL I can not select any boundary to assign conditions on. Have you guys found any way to import 3D structure as a geometry into COMSOL 4.2, or later versions? (my structure is a segmented image in .mat format). Regards, saeid

Note that while COMSOL employees may participate in the discussion forum, COMSOL® software users who are on-subscription should submit their questions via the Support Center for a more comprehensive response from the Technical Support team.