Comments (19)
Ah, found out that the RandomSparseMask ImageSampler should only be used with a fixed image mask.
from simpleelastix.
Hi Jorrit!
xout is indeed problematic and I am afraid that it is tied to the implementation of elastix itself. xout lives as as a global object outside the elastix namespace and thus is not tied to lifetime of the elastix class. Instead, any open xout buffers have to be closed manually after elastix as run. This wasn't a problem when elastix was an executable because the OS would close these buffers regardless of how the process would exit (as long as it exits). SimpleElastix has to manage these connections manually (read: I have to hack elastix) which is also why we don't use the vanilla elastix version.
It boils down the fact that xout is not closed if SimpleElastix crashes before finishing because that part of the code isn't reached, and instead xout dangles for as long as the host executable is running, e.g. your python session. The error you see is because xout tries to open the same buffers twice.
Perhaps it is possible to call the xout close code during error handling. Can you weigh in on this @mstaring? Would this be a feasible approach?
Not being able to assign parameters inside a parameter map list is known issue that is possibly tied to SWIG generated code. I don't know what to do about that :/
from simpleelastix.
Hi!
Thanks for your fast response! Is it possible to expose the xoutClose, so I can call it when I know there is an error? Or wouldn't that work?
And indeed, not being able to assign parameters inside a parameter map list was my problem, but just getting them and modifying works, so not a real problem π
from simpleelastix.
What about this issue? Does fix work?
from simpleelastix.
I am currently in the middle of rewriting some code π, but I'll test it soon!
from simpleelastix.
π
from simpleelastix.
I'm still receiving the error using transformix (haven't tested elastix), is that right?
from simpleelastix.
Can you send a minimum viable example (a few lines of code and example data) to [email protected] so I can test locally?
from simpleelastix.
Yes, will have to be this weekend or next week. Have to work on another project next couple days :(
from simpleelastix.
Np!
from simpleelastix.
I've tried it up to 9574263, and it still fails. But I see you already have a newer version, so it's compiling! π
from simpleelastix.
I'm running it from iPython right now and it crashes after every registration. I'll try to gather some debug info.
Edit:
Hmm, it stops with a Segmentation fault: 11
from simpleelastix.
If you send me a minimum viable example that reproduces the problem I will take a look!
from simpleelastix.
Sorry for the delay, but this example fails for me with commit c98a803:
import SimpleITK as sitk
def register(fixed, moving):
selx = sitk.SimpleElastix()
selx.LogToConsoleOn()
affine = sitk.GetDefaultParameterMap('affine')
affine['RequiredRatioOfValidSamples'] = ("0.99",) # Make it fail :P
plist = sitk.ParameterMapList()
plist.append(affine)
selx.SetParameterMap(plist)
selx.SetFixedImage(fixed)
selx.SetMovingImage(moving)
selx.Execute()
fixed = sitk.ReadImage('fixed.nii.gz')
moving = sitk.ReadImage('moving.nii.gz')
try:
register(fixed, moving)
except Exception as e:
print e
# This time will fail with xout
try:
register(fixed, moving)
except Exception as e:
print e
If you want, I can send you the images also?
from simpleelastix.
Yes, please do!
from simpleelastix.
https://www.dropbox.com/s/bgq4mv9mmisgxl6/fixed.nii.gz?dl=0
https://www.dropbox.com/s/sn9fah3hkmrsfo6/moving.nii.gz?dl=0
from simpleelastix.
Hi Jorrit
I have tested your script with your data and the problem seems to be solved with the new tip of the SimpleElastix branch (dde6134). Let me know if the problem persists.
from simpleelastix.
Ran it using 43167de (at the moment, latest develop) and the bug is resolved!
Sorry for the long wait!
from simpleelastix.
No problem, glad the issue has been resolved!
from simpleelastix.
Related Issues (20)
- RuntimeError: Exception thrown in SimpleITK Elastix HOT 1
- AffineDTITransform does not return the CenterOfRotationPoint
- windows user οΌthank you very much
- Gradient based optimizer: how to control learning rate HOT 2
- Rigid transformation warping with "TransformixImageFilter"
- error of compiling on linux
- Fatal error LNK1181
- Error while installing SimpleElastix on Windows. HOT 1
- Shearing matrix composition in Affine DTI 3D Transform
- Failed to build on Win10 HOT 3
- affine registration outcome measurement
- A lot of console output even after turning it off HOT 1
- Registration with initial transform obtained using SimpleITK/etc. (.tfm file) HOT 1
- The ElastixImageFilter stuck when using iterative InitialTransformParameterFileName.
- Unable to create/compile/build SimpleElastix C++ dynamic or static library in 32bit or 64-bit.
- Trouble understanding basic usage
- Is there a way to save the transform to a .tfm file?
- AttributeError: module 'SimpleITK' has no attribute 'VesselnessMeasureImageFilter'
- Use only corresponding points based transformation
- SimpleElastix no longer maintained, use SimpleITK or ITKElastix!
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 simpleelastix.