Skip to content

Commit

Permalink
Merge pull request #63 from nickdelgrosso/patch-1
Browse files Browse the repository at this point in the history
Add example of putting detection measurements into a DataFrame
  • Loading branch information
ap-- committed Aug 25, 2021
2 parents fcf5906 + 8d524dc commit eec7f61
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions docs/source/quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,22 @@ This will allow you to display extra data like this:
:width: 400
:alt: Tile Overlay Example 05


Putting Detection Measurements into a Pandas DataFrame
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Extracting data from QuPath into Pandas is similarly straightforward:

.. code-block:: python
import pandas as pd
qp = QuPathProject('./my_new_project/project.qpproj', mode='r') # open an existing project
image = qp.images[0] # get the first image
detections = image.hierarchy.detections # detections are stored in a set like proxy object
df = pd.DataFrame(detection.measurements for detection in detections) # put the measurements dictionary for each detection into a pandas DataFrame
More examples
^^^^^^^^^^^^^

Expand Down

0 comments on commit eec7f61

Please sign in to comment.