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.
import a bmp image into COMSOL geometry
Posted 2012年2月7日 GMT-5 10:10 Geometry, Materials, Structural Mechanics Version 5.0 20 Replies
Please login with a confirmed email address before reporting spam
as stated in this webpage: www.comsol.com/products/formats/ Comsol can both read and write few types of images. However, when I tried to import a bmp image as my structure for flow simulation, it was not possible, because the options given include only mphtxt, dxf, etc. Does any one know how I can get a bmp or jpeg image imported? Thanks!
Chunyan
Please login with a confirmed email address before reporting spam
I don't think it possible to set up a model geometry (is that what you want?) from a bitmap.
Cheers
Edgar
Please login with a confirmed email address before reporting spam
yes, it is, because the biofilm structure I need is very complicated. It's neither possible nor reliable to draw it with any software. I want to use the image I got from OCT analysis.
Do you know if it's possible to import txt files? The results can also be saved in txt files.
Thanks!
Chunyan
Please login with a confirmed email address before reporting spam
I think you must render the bitmap into a compatible vector format. This may be dxf or one of the available interfaces for CAD software like SolidWorks. I don't know what can be imported by textfiles. Maybe the COMSOL support can help.
However, very complicated biological structures will result in complicated geometries that are difficult to mesh and solve.
My advice would be to draw something simplified and start with it.
Cheers
Edgar
Please login with a confirmed email address before reporting spam
thank you very much for your suggestions. I've just checked that it's possible to convert bmp images into dxf format. Will try that out. Thanks!!!!!
Regards!
Chunyan
Please login with a confirmed email address before reporting spam
Did you succeed to simulate flow on converted file. I converted a .png file to DXF file and imported to COMSOL. However at the end the solution does not converge. I think we have the same problem, since I am also trying to simulate flow on image acquired from CT. Please let me know if you have found a solution.
Regards,
saeid
Please login with a confirmed email address before reporting spam
i did succeed in doing flow simulation with image imported. First right click on "Definition" under your model, select "Functions"--->"Image", then import image, define the scale of your image.
Afterwards you may need to define different viscosity for the bulk liquid and for the image part. it is done: right click on "Definition", select "Functions"---->"Analytic", in the "Expression" text box, you can define different properties corresponding to the gray level.
in my case, it is water and i used binary image. it is defined as: mu*(im2(x,y)<0.1)+mu*1e9*(im2(x,y)>=0.1) i consider that there is no water flow in the space occupied by the image. so i gave viscosity of the image part with 1e9 times higher than the area not occupied by the image. in this way, you can also define other properties simply by correcting them to the gray value.
Hope it can help you a little bit.
Chunyan :)
Please login with a confirmed email address before reporting spam
Thanks for your reply.
You saeid you imported a binary image (segmented image). May I ask about the format of your original and the imported image? Is it 2D or 3D? I converted a 2D .png image of a sphere pack to .DXF but there are some artifacts in converted image which I think are the main reasons for divergence. Would you please advise me on that?
Best regards,
saeid
Please login with a confirmed email address before reporting spam
i did 2D simulation. 3D is my next goal. i am working on that. I don't know how to convert image into geometry. A friend just told me yesterday that it's possible to do it with Matlab. But i don't know how to do it yet because i am very bad at programming. If you are good at that, you may try to do it with matlab.
Good luck!
Chunyan
Please login with a confirmed email address before reporting spam
Please login with a confirmed email address before reporting spam
I hope everything is going well with you.
I was reviewing some previous posts, looking for a possble way to export a segmented image to COMSOL as a geometry and not as a mesh. I came through this posted by you:
"i did succeed in doing flow simulation with image imported. First right click on "Definition" under your model, select "Functions"--->"Image", then import image, define the scale of your image. "
I was going to try this method for a 2D image, but I could not find "image" under "function" in definition node. Which COMSOL version you were talking about?
By the way, have you succeeded to export 3D image as a geometry to COMSOL?
I used Simpleware software and generated mesh from my 3D image and exported to COMSOL. It worked nice but for larger size of images you need lots of RAM to generate mesh and I could not do that with Simpleware and that is why I am trying to export my image to COMSOL as a geometry and let COMSOL mesh it for simulation.
Regrads,
Saeid
Please login with a confirmed email address before reporting spam
Please login with a confirmed email address before reporting spam
files are attaached
Attachments:
Please login with a confirmed email address before reporting spam
Please login with a confirmed email address before reporting spam
I'm very interested in this subject myself. In computer graphics, for example POV-Ray, there's the notion of a "bump map" which perturbs surfaces along their normal using an image. In POV-Ray it's done using a linear perturbation applied to the scattering direction of light. But it could also be applied to a displacement field. The challenge is mapping a 2-dimensional image to a 3-dimensional surface. For example maps between a 2-dimensional map and the near-spherical earth surface is a nontrivial topic.
Anyway, I'd just convert the images to PNG.
Please login with a confirmed email address before reporting spam
there are two ways to work with images in COMSOL.
The first one is to using image function as Gunnar said. It is described in previous answers.
The second one needs Matlab LiveLink. If you do have that module, check how to use the function "mphimage2geom' in the user guide. The function can convert your image into geometry. It supports quite some image formats. So then you can assign a lot of different properties to your geometry, which is not possible with the first method. There is example how to use the function in the user guide. Especially in the end when you want to calculate something, for example boundary flux, it is possible with this method, but not the first one.
To your specific question, I am very bad in thermal dynamics. Can't really give any tip for your specific question. Sorry for that. Hope this will somehow help you a little bit.
Please login with a confirmed email address before reporting spam
i read u did succeed the process of SEM into Comsol, how?can i get in touch with u
Please login with a confirmed email address before reporting spam
mphimage2geom cammond unforunatly only works for 2D geometry. If I want to do 3D, do you know how? I have several MRI images and I want COMSOL to plot them in 3D.
Thank you!
Fei
Please login with a confirmed email address before reporting spam
i have an X-ray CT image, and binarized it using imagej.
Exportable image formats are png, jpg etc... but comsol cannot import them directly.
Therefore I imported them to Autocad and exported it to dxf files, it still did not work out.
What programs did you use to import those grey scale value?
Would my binarized images work fine with your method?
Please login with a confirmed email address before reporting spam
Can you please tell how did you import dxf file in geometry.
Thanks..
Please login with a confirmed email address before reporting spam
2D dxf files can be imported with just the core COMSOL Multiphysics.
For 3D dxf files, you will need to have one of the optional COMSOL products for CAD import.
See the CAD Specification Chart www.comsol.com/products/specifications/cad/ for more details.
Best regards,
Jeff
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.
Suggested Content
- BLOG Как создавать высококачественные изображения с результатами моделирования в COMSOL Multiphysics®
- BLOG How to Use an Add-In to Convert Images to Geometry Models
- BLOG How to Create High-Quality Model Images in COMSOL Multiphysics®
- KNOWLEDGE BASE Can COMSOL import topological data, meshes and images?
- KNOWLEDGE BASE Error: Failed to Connect to PTC Creo Parametric