Git Product home page Git Product logo

regional's Introduction

regional

Latest Version Build Status

manipulation and display of spatial regions in python

This package makes it easy to display spatial regions, and is useful when working with geometries, maps, feature extraction, or other spatial analyses. Designed to be small and light-weight, built on numpy and scipy, and composes with other modules for image analysis and display.

install

pip install regional

example

from regional import one

region = one([[0, 0], [0, 1], [1, 0], [1, 1]])

region.bbox
>> [[0, 1], [0, 1]]

region.center
>> [0.5, 0.5]

see the included notebook for a longer example

usage

region = one(coords)

constructs a single region

  • coords
    • list of coordinates [[x, y], [x, y], ...]

many

regions = many(list)

  • list :
    • list of regions [region, region, ...] or
    • list of lists of coordinates [[[x, y], [x, y], ...], [[x, y], [x, y], ...], ...]

many

one region and many regions have the same attributes and methods, the only difference is that in the case of many regions they are just evaluated once per region

attributes

region.hull

convex hull

region.bbox

rectangular bounding box

region.center

euclidean center

region.extent

total region extent

methods

region.distance(other)

distance to other region

region.merge(other)

merge with other region

region.exclude(other)

exclude other region

region.overlap(other, method)

compute overlap with other region

region.crop(min, max)

crop region to bounds

region.inbounds(min, max)

check whether region falls completely within bounds

region.dilate(size)

dilate region

region.outline(inner, outer)

compute region outline

region.mask(dims, base, fill, stroke, background, value, cmap)

generate image with regions as colored masks (value and cmap only for multiple regions)

regional's People

Contributors

freeman-lab avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.