Metadata-Version: 2.4
Name: napari-crop
Version: 0.1.12
Summary: Crop regions in napari manually
Author: Tim Morello, Marcelo Leomil Zoccoler, Johannes Soltwedel
Author-email: Robert Haase <robert.haase@tu-dresden.de>
License: 
        Copyright (c) 2021, Robert Haase, Tim Morello, Marcelo Zoccoler, DFG Cluster of Excellence "Physics of Life", TU Dresden
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
        modification, are permitted provided that the following conditions are met:
        
        * Redistributions of source code must retain the above copyright notice, this
          list of conditions and the following disclaimer.
        
        * Redistributions in binary form must reproduce the above copyright notice,
          this list of conditions and the following disclaimer in the documentation
          and/or other materials provided with the distribution.
        
        * Neither the name of napari-manual-split-and-merge-labels nor the names of its
          contributors may be used to endorse or promote products derived from
          this software without specific prior written permission.
        
        THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
        AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
        IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
        DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
        FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
        DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
        SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
        CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
        OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
        OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
        
Project-URL: Homepage, https://github.com/biapol/napari-crop
Project-URL: Bug Tracker, https://github.com/biapol/napari-crop/issues
Project-URL: Documentation, https://github.com/biapol/napari-crop#README.md
Project-URL: Source Code, https://github.com/biapol/napari-crop
Project-URL: User Support, https://github.com/biapol/napari-crop/issues
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Framework :: napari
Classifier: Topic :: Scientific/Engineering :: Image Processing
Classifier: Topic :: Scientific/Engineering :: Information Analysis
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Operating System :: OS Independent
Classifier: License :: OSI Approved :: BSD License
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: napari-plugin-engine>=0.1.4
Requires-Dist: numpy
Requires-Dist: scikit-image
Requires-Dist: napari-tools-menu>=0.1.17
Requires-Dist: napari-workflows
Provides-Extra: testing
Requires-Dist: tox; extra == "testing"
Requires-Dist: pytest; extra == "testing"
Requires-Dist: pytest-cov; extra == "testing"
Requires-Dist: pytest-qt; extra == "testing"
Requires-Dist: napari; extra == "testing"
Requires-Dist: pyqt5; extra == "testing"
Dynamic: license-file

# napari-crop

[![License](https://img.shields.io/pypi/l/napari-crop.svg?color=green)](https://github.com/BiAPoL/napari-crop/raw/master/LICENSE)
[![PyPI](https://img.shields.io/pypi/v/napari-crop.svg?color=green)](https://pypi.org/project/napari-crop)
[![Python Version](https://img.shields.io/pypi/pyversions/napari-crop.svg?color=green)](https://python.org)
[![tests](https://github.com/BiAPoL/napari-crop/workflows/tests/badge.svg)](https://github.com/BiAPoL/napari-crop/actions)
[![codecov](https://codecov.io/gh/BiAPoL/napari-crop/branch/main/graph/badge.svg)](https://codecov.io/gh/BiAPoL/napari-crop)
[![DOI](https://zenodo.org/badge/419822240.svg)](https://zenodo.org/badge/latestdoi/419822240)

🚨🚨🚨 **Call for maintainers** 🚨🚨🚨

If you are interested in further developing it, please get in touch or create a fork.

Crop regions in napari manually

![](https://github.com/BiAPoL/napari-crop/raw/main/images/screencast.gif)

Crop in any dimension

![](https://github.com/BiAPoL/napari-crop/raw/main/images/side_crop.gif)

Cut a volume using a plane

*Note:*

*- this functionality currently only works with 3D data*

*- to drag the plane, hold the 'SHIFT' key from your keyboard*

![](https://github.com/BiAPoL/napari-crop/raw/main/images/napari_crop_cut_with_plane_demo.gif)

Draw shapes of fixed size at given coordinates for later cropping

*Note:*

*- the shapes are drawn with the specified width and height, but, since the crop widget is very permissive as it tends to include all pixels the shape "touches", the cropped result tends to be 1pixel larger in both dimensions. Therefore, to have a 64x64 array after cropping, it is best to set the shape sizes here to 63x63 for example.*

![](https://github.com/BiAPoL/napari-crop/raw/main/images/napari_crop_draw_shapes.gif)

## Usage
Create a new shapes layer to annotate the region you would like to crop:

![](https://github.com/BiAPoL/napari-crop/raw/main/images/shapes.png)

Use the rectangle tool to annotate a region. Start the `crop` tool from the `Plugins > napari-crop > Crop region` or, if available, `Tools > Utilities > Crop region` menu or `Layer > Transform > Crop region(s)`. 
Click the `Run` button to crop the region.

![](https://github.com/BiAPoL/napari-crop/raw/main/images/draw_rectangle.png)

You can also use the `Select shapes` tool to move the rectangle to a new place and crop another region by clicking on `Run`.

![](https://github.com/BiAPoL/napari-crop/raw/main/images/move_rectangle.png)

Hint: You can also use the [napari-tabu](https://www.napari-hub.org/plugins/napari-tabu) plugin to send all your cropped images to a new napari window.

![](https://github.com/BiAPoL/napari-crop/raw/main/images/new_window.gif)

----------------------------------

This [napari] plugin was generated with [Cookiecutter] using with [@napari]'s [cookiecutter-napari-plugin] template.

## Installation

You can install `napari-crop` via [pip]:

    pip install napari-crop

## Contributing

Contributions are very welcome. 

## License

Distributed under the terms of the [BSD-3] license,
"napari-crop" is free and open source software

## Issues

If you encounter any problems, please create a thread on [image.sc] along with a detailed description and tag [@haesleinhuepf].

[napari]: https://github.com/napari/napari
[Cookiecutter]: https://github.com/audreyr/cookiecutter
[@napari]: https://github.com/napari
[MIT]: http://opensource.org/licenses/MIT
[BSD-3]: http://opensource.org/licenses/BSD-3-Clause
[GNU GPL v3.0]: http://www.gnu.org/licenses/gpl-3.0.txt
[GNU LGPL v3.0]: http://www.gnu.org/licenses/lgpl-3.0.txt
[Apache Software License 2.0]: http://www.apache.org/licenses/LICENSE-2.0
[Mozilla Public License 2.0]: https://www.mozilla.org/media/MPL/2.0/index.txt
[cookiecutter-napari-plugin]: https://github.com/napari/cookiecutter-napari-plugin
[file an issue]: https://github.com/BiAPoL/napari-crop/issues
[napari]: https://github.com/napari/napari
[tox]: https://tox.readthedocs.io/en/latest/
[pip]: https://pypi.org/project/pip/
[PyPI]: https://pypi.org/
[image.sc]: https://image.sc
[@haesleinhuepf]: https://twitter.com/haesleinhuepf

