Comments (7)
from connected-components-3d.
Thanks @william-silversmith!
from connected-components-3d.
Hi!
Thanks for writing in.
The first centroid is for label 0
and the second is for label 1
.
I took at look at your example, and it seems the reason is a loss of precision in float32 as its summing across a large area. When I upgrade from float to double, the numbers come out right. Float32 can represent a large range, but only has full precision for integers up to 10^7.
512 * 511 / 2 * 512 * 512 = 34e9
I'll see if I can find a nice fix for this.
from connected-components-3d.
It looks like this used to be float64 but there was a problem with memory consumption.
Hmm....
from connected-components-3d.
Thanks for looking into this.
If I change the test image to be ones only between [10:20, 10:20, 10:20] and zeros elsewhere the background centroid is still around [64, 64, 64]. That shouldn’t be the case right?
from connected-components-3d.
That's also loss of precision and changing the foreground doesn't affect it that much since the vast majority of background pixels are black in both scenarios. When I change it to double, it gives something like the right result (256.29568989, 256.29568989, 256.29568989) which is still a bit off...
I have to figure out some way to prevent the sum from blowing up so high without sacrificing accuracy and memory efficiency.
from connected-components-3d.
It was kind of tricky to figure out a method for doing this that used less memory than simply bumping to double, so I'll release a new version with that once the build completes. The precision for double is actually pretty good, I forgot to account for the large "hole" in the data before.
I'll let you know when the new version is released.
from connected-components-3d.
Related Issues (20)
- Applying Dust and largest_k dtype output option HOT 2
- dust sugnature HOT 1
- Massive memory Leak HOT 7
- 1D Array of 4 Elements Incorrect HOT 5
- Cannot find reference 'dust' in 'cc3d.py' HOT 2
- Question on comparing individual lesions between two masks based on the cc3d.statistics output. HOT 1
- Additional metrics support HOT 2
- Does cc3d also work with memmory-mapped numpy arrays and array-like data? HOT 14
- cc3d.statistics["bounding_boxes"] are wrong HOT 1
- largest_k fails for transposed arrays HOT 6
- About the lastest_k function HOT 4
- Question on the output of contacts HOT 9
- Periodic Boundary Conditions HOT 4
- Is the output label of largest_k ordered? HOT 2
- Add a better error for type support. HOT 4
- Any way to make this GPU Compatible? HOT 5
- Applying dust to labels does not do anything HOT 3
- Support for Numpy 2.0 HOT 3
- cc3d.dust fails HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from connected-components-3d.