Skip to content

Latest commit

 

History

History
86 lines (61 loc) · 2.71 KB

README.org

File metadata and controls

86 lines (61 loc) · 2.71 KB

MatrixViz

A simple library to visualize core.matrix matrices and dtype-next tensors.

Useful Aliases

check-deps

To check for outdated dependencies, run:

clojure -M:check-deps

Remember to update deps.edn with any new versions that are found.

check-reflections

To check for reflection warnings, run:

clojure -M:check-reflections

Remember to add type hints as necessary to remove these once found.

deploy-jar

To build a JAR from this library and deploy it to clojars.org, run:

env CLOJARS_USERNAME=your-username CLOJARS_PASSWORD=your-clojars-token clojure -M:deploy-jar

NOTE: As of 2020-06-27, Clojars will no longer accept your Clojars password when deploying. You will have to use a token instead. Please read more about this here.

API Usage

(save-matrix-as-png color-ramp pixels-per-cell nodata-value matrix filename)

This will render the matrix as either an 8-bit grayscale image (color-ramp = :gray), an 8-bit grayscale image with semilog scaling (color-ramp = :graylog), an 8-bit RGB image (color-ramp = :color), or an 8-bit RGB image with semilog scaling (color-ramp = :colorlog) and save it to the given filename in PNG format. Any pixels matching nodata-value will be masked out. The size of the output image will be rows * pixels-per-cell by columns * pixels-per-cell, where pixels-per-cell is a positive integer.

(apply-mask base-layer mask-layer nodata-value)

This helper function produces a new matrix containing the values in base-layer wherever mask-layer is positive. All other cells are set to nodata-value. Use this if you want to mask out values from base-layer before sending it to save-matrix-as-png.

(blend-matrix matrix blend-radius nodata-value & {:keys [normalize?]})

This helper function creates a new matrix whose values are the averages of its neighboring values within blend-radius steps. Cells containing the nodata-value are unchanged by this operation. If :normalize? = true, it scales the blended values to match the value range in matrix.

(bleed-matrix matrix bleed-radius nodata-value bleed-test?)

This helper function creates a new matrix in which all cells whose values pass bleed-test? are copied into their neighboring cells out to distance bleed-radius. Cells containing the nodata-value are unchanged by this operation.

License

Copyright © 2014-2022 Gary W. Johnson ([email protected])

Distributed under the terms of the Eclipse Public License version 2.0 (EPLv2). See LICENSE.txt in this directory for more information.