Python bindings for JIGSAW: a Delaunay-based unstructured mesh generator.

Overview

JIGSAW: An unstructured mesh generator

JIGSAW is an unstructured mesh generator and tessellation library; designed to generate high-quality triangulations and polyhedral decompositions of general planar, surface and volumetric domains. JIGSAW includes refinement-based algorithms for the construction of new meshes, optimisation-driven techniques for the improvement of existing grids, as well as routines to assemble (restricted) Delaunay tessellations, Voronoi complexes and Power diagrams.

This package provides a Python based scripting interface to the underlying JIGSAW mesh generator, including a range of additional facilities for file I/O, mesh visualisation and post-processing operations.

JIGSAW has been compiled and tested on various 64-bit Linux , Windows and Mac based platforms.

Quickstart

Ensure you have a c++ compiler and the cmake utility installed.
Clone/download + unpack this repository.
python3 setup.py build_external
python3 setup.py install
python3 example.py --IDnumber=0

Note: installation of JIGSAW requires a c++ compiler and the cmake utility. JIGSAW may also be installed as a conda package. See here for details.

Function Listing

See jigsawpy for a description of the various functions available.

setup.py    - compile and install JIGSAW's c++ backend using cmake.
example.py  - a list of demo programs. 

jigsaw.py   - cmd-line interface to JIGSAW's backend
libsaw.py   - api-lib. interface to JIGSAW's backend

loadmsh.py  - load *.msh files.
savemsh.py  - save *.msh files.
loadjig.py  - load *.jig files.
savejig.py  - save *.jig files.

project.py  - apply cartographic projection operators to mesh obj.

bisect.py   - refine a mesh obj. via bisection.
extrude.py  - create a mesh obj. via extrusion.

Example Problems

The following set of example problems are available in example.py:

example: 0; # simple 2-dim. examples to get started
example: 1; # simple 3-dim. examples to get started
example: 2; # frontal-delaunay methods in the plane
example: 3; # frontal-delaunay methods for surfaces
example: 4; # frontal-delaunay methods for volumes
example: 5; # user-defined mesh-spacing constraints
example: 6; # dealing with sharp-features in piecewise smooth domains
example: 7; # dealing with sharp-features in piecewise smooth domains
example: 8; # (re)mesh marching-cubes style outputs
example: 9; # creating prismatic volumes via extrusion

Run python3 example.py --IDnumber=N to call the N-th example. *.vtk output is saved to ../cache and can be visualised with, for example, Paraview.

License

This program may be freely redistributed under the condition that the copyright notices (including this entire header) are not removed, and no compensation is received through use of the software. Private, research, and institutional use is free. You may distribute modified versions of this code UNDER THE CONDITION THAT THIS CODE AND ANY MODIFICATIONS MADE TO IT IN THE SAME FILE REMAIN UNDER COPYRIGHT OF THE ORIGINAL AUTHOR, BOTH SOURCE AND OBJECT CODE ARE MADE FREELY AVAILABLE WITHOUT CHARGE, AND CLEAR NOTICE IS GIVEN OF THE MODIFICATIONS. Distribution of this code as part of a commercial system is permissible ONLY BY DIRECT ARRANGEMENT WITH THE AUTHOR. (If you are not directly supplying this code to a customer, and you are instead telling them how they can obtain it for free, then you are not required to make any arrangement with me.)

DISCLAIMER: Neither I nor: Columbia University, the Massachusetts Institute of Technology, the University of Sydney, nor the National Aeronautics and Space Administration warrant this code in any way whatsoever. This code is provided "as-is" to be used at your own risk.

References

There are a number of publications that describe the algorithms used in JIGSAW in detail. If you make use of JIGSAW in your work, please consider including a reference to the following:

[1] - Darren Engwirda: Generalised primal-dual grids for unstructured co-volume schemes, J. Comp. Phys., 375, pp. 155-176, https://doi.org/10.1016/j.jcp.2018.07.025, 2018.

[2] - Darren Engwirda, Conforming Restricted Delaunay Mesh Generation for Piecewise Smooth Complexes, Procedia Engineering, 163, pp. 84-96, https://doi.org/10.1016/j.proeng.2016.11.024, 2016.

[3] - Darren Engwirda, Voronoi-based Point-placement for Three-dimensional Delaunay-refinement, Procedia Engineering, 124, pp. 330-342, http://dx.doi.org/10.1016/j.proeng.2015.10.143, 2015.

[4] - Darren Engwirda, David Ivers, Off-centre Steiner points for Delaunay-refinement on curved surfaces, Computer-Aided Design, 72, pp. 157-171, http://dx.doi.org/10.1016/j.cad.2015.10.007, 2016.

[5] - Darren Engwirda, Locally-optimal Delaunay-refinement and optimisation-based mesh generation, Ph.D. Thesis, School of Mathematics and Statistics, The University of Sydney, http://hdl.handle.net/2123/13148, 2014.

Comments
  • pathlib requirement

    pathlib requirement

    pathlib is listed as a requirement for all python versions, but it is part of the system in python >=3.4 (i.e. all currently supported version of python). Because of this dependency, pip check fails when jigsawpy is installed for python 3.x. I would request that it either be removed as a dependency in the next release or that it be constrained to python versions before 3.4.

    https://docs.python.org/3/library/pathlib.html

    enhancement 
    opened by xylar 9
  • The python package includes the `tests` directory

    The python package includes the `tests` directory

    Because of the line: https://github.com/dengwirda/jigsaw-python/blob/b6e455c22696568f90a7428a49e03c980892c923/setup.py#L135 the tests directory is being included in the conda-forge (and presumably the pypi) package. This directory should be excluded, or better yet only jigsawpy should be included:

    packages=find_packages(include=['jigsawypy', 'jigsawpy.*'])
    
    for-next-release 
    opened by xylar 5
  • Add call to find_library

    Add call to find_library

    This helps Windows find jigsaw.dll without a full path name.

    A similar call seems not to be needed for Linux and not to work for OSX.

    I created a patch identical to this in the conda-forge recipe: https://github.com/conda-forge/staged-recipes/pull/10842/commits/b8d1bc4d9cffadf1c8ca62069d5f6e676cc271e4

    opened by xylar 1
  • Update to jigsaw-0.9.15.x

    Update to jigsaw-0.9.15.x

    • Update to jigsaw-0.9.15.x.
    • Fix an i/o bug in handling of jig_t objects.
    • Fix an array-size bug in orthoball routines.
    • Add support for "jumbled" meshes.
    • Remove pathlib from REQUIRED in setup.py.
    • Support ellipsoidal-type initial conditions.
    • BREAKING: encode h(x) values as 32-bit floating point data to support "very-large" h(x) types.
    opened by dengwirda 0
  • Accelerating rDT mesh and optm iter.

    Accelerating rDT mesh and optm iter.

    Hello, I was wondering if there is any way to speed up the rDT mesh and Mesh optm parts of the jigsaw-python subtree source. Currently, I am compiling with gcc-11, using the standard CMake approach (maybe there's an optimization switch I haven't enabled?). I tried compiling it with intel 2018 and 2019 but I wasn't successful with the compilation. Any ideas on achieving some speed-ups will be greatly appreciated. Thanks, -J.

    opened by jreniel 0
  • Consider using specific exceptions rather than generic `Exception`

    Consider using specific exceptions rather than generic `Exception`

    I don't find the exceptions raised by jigsawpy to be very intuitive, and I think that might be true for most python users.

    As an example: https://github.com/dengwirda/jigsaw-python/blob/f87571945975b4882d8c27bdfff9275f6e46baa8/jigsawpy/savemsh.py#L613

    I would expect something like:

        if (not isinstance(name, str)):
            raise TypeError("Argument 'name' to savemsh should be of type str")
    

    As I understand it, the generic Exception class is only intended as a base class for exceptions and shouldn't be used directly.

    Python is case sensitive so the use of NAME here also led to some confusion for me.

    for-next-release 
    opened by xylar 6
  • Still getting output to the terminal with `opts.verbosity = -1`

    Still getting output to the terminal with `opts.verbosity = -1`

    I was told that opts.verbosity = -1 should mean that no output went to the terminal window, just to the log file. But I am finding that I still get terminal output when I have this option set. I verified that the .jig file does, indeed have:

      VERBOSITY=-1
    

    but I still see something like this to the terminal:

    #------------------------------------------------------------
    #
    #   ,o, ,o,       /                                 
    #    `   `  e88~88e  d88~\   /~~~8e Y88b    e    / 
    #   888 888 88   88 C888         88b Y88b  d8b  /   
    #   888 888 "8b_d8"  Y88b   e88~-888  Y888/Y88b/  
    #   888 888  /        888D C88   888   Y8/  Y8/     
    #   88P 888 Cb      \_88P   "8b_-888    Y    Y    
    # \_8"       Y8""8D                             
    #
    #------------------------------------------------------------
    # JIGSAW: an unstructured mesh generation library.  
    #------------------------------------------------------------
    ...
    
    bug for-next-release 
    opened by xylar 2
  • Cannot create an icosahedral mesh without providing a mesh argument

    Cannot create an icosahedral mesh without providing a mesh argument

    It seems the intention is that one can create an icosahedral mesh without passing a mesh object: https://github.com/dengwirda/jigsaw-python/blob/b6e455c22696568f90a7428a49e03c980892c923/jigsawpy/init.py#L105 but when I try this:

            jigsawpy.cmd.icosahedron(opts, subdivisions)
    

    I get:

    Traceback (most recent call last):
      File "/home/xylar/miniconda3/envs/compass_jigsaw_mesh/bin/compass", line 33, in <module>
        sys.exit(load_entry_point('compass', 'console_scripts', 'compass')())
      File "/home/xylar/code/compass/separate_mesh_steps/compass/__main__.py", line 63, in main
        commands[args.command]()
      File "/home/xylar/code/compass/separate_mesh_steps/compass/run/serial.py", line 281, in main
        run_step()
      File "/home/xylar/code/compass/separate_mesh_steps/compass/run/serial.py", line 249, in run_step
        test_case.run()
      File "/home/xylar/code/compass/separate_mesh_steps/compass/ocean/tests/global_ocean/mesh/__init__.py", line 109, in run
        super().run()
      File "/home/xylar/code/compass/separate_mesh_steps/compass/testcase.py", line 190, in run
        self._run_step(step, self.new_step_log_file)
      File "/home/xylar/code/compass/separate_mesh_steps/compass/testcase.py", line 306, in _run_step
        step.run()
      File "/home/xylar/code/compass/separate_mesh_steps/compass/mesh/spherical.py", line 350, in run
        self.make_jigsaw_mesh(subdivisions)
      File "/home/xylar/code/compass/separate_mesh_steps/compass/mesh/spherical.py", line 376, in make_jigsaw_mesh
        jigsawpy.cmd.icosahedron(opts, subdivisions)
      File "/home/xylar/miniconda3/envs/compass_jigsaw_mesh/lib/python3.9/site-packages/jigsawpy/__init__.py", line 106, in icosahedron
        return jigsaw.icosahedron(
      File "/home/xylar/miniconda3/envs/compass_jigsaw_mesh/lib/python3.9/site-packages/jigsawpy/jigsaw.py", line 597, in icosahedron
        raise Exception("Incorrect type: MESH.")
    Exception: Incorrect type: MESH.
    

    It seems that this check: https://github.com/dengwirda/jigsaw-python/blob/b6e455c22696568f90a7428a49e03c980892c923/jigsawpy/jigsaw.py#L519-L520 should check for None:

        if (mesh is not None and not isinstance(mesh, jigsaw_msh_t)):
            raise Exception("Incorrect type: MESH.")
    
    bug for-next-release 
    opened by xylar 2
  • pip, setup, build_external, etc

    pip, setup, build_external, etc

    Are the method(s) used to install binaries sufficient? Currently, two options are supported:

    1. setup.py build_external, etc builds and installs the jigsaw-cpp binaries within jigsawpy itself.
    2. If no local binaries are found, a global search of the machine path is done to pick them up in, e.g. usr/local/bin, etc --- used by the conda-based workflow.

    @jreniel has suggested installing to the python environment directory, either as a 3rd option, or, perhaps(?) a replacement for 1.

    Should also work out what's needed to make jigsawpy available for direct install via pip.

    enhancement 
    opened by dengwirda 6
Releases(v0.3.3)
Owner
Darren Engwirda
Computational scientist at LANL --- climate modelling, unstructured grids, numerical methods.
Darren Engwirda
This is a project to detect gestures to zoom in or out, using the real-time distance between the index finger and the thumb. It's based on OpenCV and Mediapipe.

Pinch-zoom This is a python project based on real-time hand-gesture detection, to zoom in or out, using the distance between the index finger and the

Harshit Bhalla 6 Jul 11, 2022
Tools for manipulating and evaluating the hOCR format for representing multi-lingual OCR results by embedding them into HTML.

hocr-tools About About the code Installation System-wide with pip System-wide from source virtualenv Available Programs hocr-check -- check the hOCR f

OCRopus 285 Dec 08, 2022
Regions sanitàries (RS), Sectors Sanitàris (SS) i Àrees Bàsiques de Salut (ABS) de Catalunya

Regions sanitàries (RS), Sectors Sanitaris (SS), Àrees de Gestió Assistencial (AGA) i Àrees Bàsiques de Salut (ABS) de Catalunya Fitxers GeoJSON de le

Glòria Macià Muñoz 2 Jan 23, 2022
A Vietnamese personal card OCR website built with Django.

Django VietCardOCR Installation Creation of virtual environments is done by executing the command venv: python -m venv venv That will create a new fol

Truong Hoang Thuan 4 Sep 04, 2021
With the virtual keyboard, you can write on the real time images by combining the thumb and index fingers on the letter you want.

Virtual Keyboard With the virtual keyboard, you can write on the real time images by combining the thumb and index fingers on the letter you want. At

Güldeniz Bektaş 5 Jan 23, 2022
Image processing using OpenCv

Image processing using OpenCv Write a program that opens the webcam, and the user selects one of the following on the video: ✅ If the user presses the

M.Najafi 4 Feb 18, 2022
Implement 'Single Shot Text Detector with Regional Attention, ICCV 2017 Spotlight'

SSTDNet Implement 'Single Shot Text Detector with Regional Attention, ICCV 2017 Spotlight' using pytorch. This code is work for general object detecti

HotaekHan 84 Jan 05, 2022
Primary QPDF source code and documentation

QPDF QPDF is a command-line tool and C++ library that performs content-preserving transformations on PDF files. It supports linearization, encryption,

QPDF 2.2k Jan 04, 2023
computer vision, image processing and machine learning on the web browser or node.

Image processing and Machine learning labs   computer vision, image processing and machine learning on the web browser or node note Fast Fourier Trans

ryohei tanaka 487 Nov 11, 2022
Ddddocr - 通用验证码识别OCR pypi版

带带弟弟OCR通用验证码识别SDK免费开源版 今天ddddocr又更新啦! 当前版本为1.3.1 想必很多做验证码的新手,一定头疼碰到点选类型的图像,做样本费时

Sml2h3 4.4k Dec 31, 2022
Use Convolutional Recurrent Neural Network to recognize the Handwritten line text image without pre segmentation into words or characters. Use CTC loss Function to train.

Handwritten Line Text Recognition using Deep Learning with Tensorflow Description Use Convolutional Recurrent Neural Network to recognize the Handwrit

sushant097 224 Jan 07, 2023
keras复现场景文本检测网络CPTN: 《Detecting Text in Natural Image with Connectionist Text Proposal Network》;欢迎试用,关注,并反馈问题...

keras-ctpn [TOC] 说明 预测 训练 例子 4.1 ICDAR2015 4.1.1 带侧边细化 4.1.2 不带带侧边细化 4.1.3 做数据增广-水平翻转 4.2 ICDAR2017 4.3 其它数据集 toDoList 总结 说明 本工程是keras实现的CPTN: Detecti

mick.yi 107 Jan 09, 2023
A Python script to capture images from multiple webcams at once and save them into your local machine

Capturing multiple images at once from Webcam Using OpenCV Capture multiple image by accessing the webcam of your system and save it to your machine.

Fazal ur Rehman 2 Apr 16, 2022
Bu uygulamada Python ve Opencv kullanarak bilgisayar kamerasından yüz tespiti yapıyoruz.

opencv_yuz_bulma Bu uygulamada Python ve Opencv kullanarak bilgisayar kamerasından yüz tespiti yapıyoruz. Bilgisarın kendi kamerasını kullanmak için;

Ahmet Haydar Ornek 6 Apr 16, 2022
Detect text blocks and OCR poorly scanned PDFs in bulk. Python module available via pip.

doc2text doc2text extracts higher quality text by fixing common scan errors Developing text corpora can be a massive pain in the butt. Much of the tex

Joe Sutherland 1.3k Jan 04, 2023
OCR, Scene-Text-Understanding, Text Recognition

Scene-Text-Understanding Survey [2015-PAMI] Text Detection and Recognition in Imagery: A Survey paper [2014-Front.Comput.Sci] Scene Text Detection and

Alan Tang 354 Dec 12, 2022
Pure Javascript OCR for more than 100 Languages 📖🎉🖥

Version 2 is now available and under development in the master branch, read a story about v2: Why I refactor tesseract.js v2? Check the support/1.x br

Project Naptha 29.2k Jan 05, 2023
Developed an AI-based system to control the mouse cursor using Python and OpenCV with the real-time camera.

Developed an AI-based system to control the mouse cursor using Python and OpenCV with the real-time camera. Fingertip location is mapped to RGB images to control the mouse cursor.

Ravi Sharma 71 Dec 20, 2022
Detect and fix skew in images containing text

Alyn Skew detection and correction in images containing text Image with skew Image after deskew Install and use via pip! Recommended way(using virtual

Kakul 230 Dec 21, 2022
Generate text images for training deep learning ocr model

New version release:https://github.com/oh-my-ocr/text_renderer Text Renderer Generate text images for training deep learning OCR model (e.g. CRNN). Su

Qing 1.2k Jan 04, 2023