Skip to content

Add Mask Statistics plugin with CSV export support - #8

Open
Prat260104 wants to merge 1 commit into
invesalius:mainfrom
Prat260104:add-mask-statistics-plugin
Open

Add Mask Statistics plugin with CSV export support#8
Prat260104 wants to merge 1 commit into
invesalius:mainfrom
Prat260104:add-mask-statistics-plugin

Conversation

@Prat260104

Copy link
Copy Markdown

Overview

This PR introduces a new plugin: Mask Statistics.

While exploring the InVesalius plugin architecture and segmentation workflow,
I implemented this plugin to better understand how masks are internally represented
and how quantitative metrics can be exposed safely through the plugin system.

Features

  • Displays basic mask statistics (voxel count, masked voxels)
  • Computes physical volume (mm³ and cm³)
  • Shows occupancy percentage
  • Provides technical metadata (array shape, voxel spacing)
  • Optional CSV export for external analysis

Implementation Notes

  • Implemented entirely through the existing plugin system
  • No modifications to core logic
  • Uses mask data structures already available in the codebase
  • Designed to fail gracefully if no mask is selected
  • CSV export implemented using Python standard library only

Testing

Tested locally on macOS (Apple Silicon):

  • Loaded sample dataset
  • Created multiple masks
  • Verified statistics consistency
  • Validated CSV export output

The plugin is fully isolated and does not affect existing functionality.

1 2 3 4

@Prat260104

Copy link
Copy Markdown
Author

Hi @tfmoraes @rmatsuda sir,

Just a gentle follow-up on this PR.
I’d appreciate any feedback whenever you have time.

If there are changes required (design, structure, documentation, or tests), I’d be happy to update accordingly.

Thanks again!

@Prat260104

Copy link
Copy Markdown
Author

Hi @rmatsuda sir,

I’ve been exploring the InVesalius codebase to better understand the mask and visualization workflow, and as part of that exploration I implemented this Mask Statistics plugin to deepen my understanding of the plugin architecture.

I would appreciate your feedback when you have time, particularly regarding whether this aligns well with the existing plugin structure and if there are architectural or structural improvements you would recommend.

I’m continuing to study the codebase and would be glad to refine the implementation based on your suggestions.

Thank you.

— Prateek

@Prat260104

Copy link
Copy Markdown
Author

hello @paulojamorim kindly review the PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant