Registering two volumes along with mask is giving expection for sampler type "RandomSparseMask" #1255
yackmurali
started this conversation in
General
Replies: 1 comment 2 replies
-
@yackmurali Thank you for your question! Can you possibly share a few more lines of your code? How do you pass the mask image to elastix? Did you locally build elastix? If so, maybe you can make debug build, and put a break-point in the debugger at itkImageRandomSamplerSparseMask.hxx line 44, to see where it goes wrong! |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
We have tried to perform the elastix registration for two 3D volumes and used the mask along with them. It is giving issue in C++ API but working file when passing through exe with sampler "RandomSparseMask" set it parameter map.
The following is the output we get:
Running elastix with parameter map 0
Current time: Fri Oct 18 12:38:29 2024.
ELASTIX version: 5.2.0
Command line options from ElastixBase:
-out D:\Python_projects\new_WMH_code\WMH2.0\275_100002450\20170417\cpp_results\Elastix_results/
-priority unspecified, so NORMAL process priority
-threads unspecified, so all available threads are used
Command line options from TransformBase:
-t0 unspecified, so no initial transform used
Reading images...
Reading images took 0 ms.
WARNING: the fixed pyramid schedule is not fully specified!
A default pyramid schedule is used.
WARNING: the moving pyramid schedule is not fully specified!
A default pyramid schedule is used.
WARNING: The parameter "CenterOfGravityUsesLowerThreshold", requested at entry number 0, does not exist at all.
The default value "false" is used instead.
WARNING: The parameter "NumberOfSamplesForCenteredTransformInitialization", requested at entry number 0, does not exist at all.
The default value "10000" is used instead.
Transform parameters are initialized as: [1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0]
InitializeTransform took 0.00s
Scales are estimated automatically.
Scales for transform parameters are: [2693.969331634363, 4794.691475386296, 6352.22389482894, 2693.969331634363, 4794.691475386296, 6352.22389482894, 2693.969331634363, 4794.691475386296, 6352.22389482894, 1, 1, 1]
Initialization of all components (before registration) took: 9 ms.
Preparation of the image pyramids took: 13 ms.
Resolution: 0
WARNING: The parameter "CheckNumberOfSamples", requested at entry number 0, does not exist at all.
The default value "true" is used instead.
WARNING: The parameter "UseMultiThreadingForMetrics", requested at entry number 0, does not exist at all.
The default value "true" is used instead.
Setting the fixed masks took: 0 ms.
Setting the moving masks took: 0 ms.
WARNING: The parameter "NumberOfFixedHistogramBins", requested at entry number 0, does not exist at all.
The default value "32" is used instead.
WARNING: The parameter "NumberOfMovingHistogramBins", requested at entry number 0, does not exist at all.
The default value "32" is used instead.
WARNING: The parameter "FixedLimitRangeRatio", requested at entry number 0, does not exist at all.
The default value "0.01" is used instead.
WARNING: The parameter "MovingLimitRangeRatio", requested at entry number 0, does not exist at all.
The default value "0.01" is used instead.
WARNING: The parameter "UseFastAndLowMemoryVersion", requested at entry number 0, does not exist at all.
The default value "true" is used instead.
WARNING: The parameter "UseJacobianPreconditioning", requested at entry number 0, does not exist at all.
The default value "false" is used instead.
WARNING: The parameter "FiniteDifferenceDerivative", requested at entry number 0, does not exist at all.
The default value "false" is used instead.
WARNING: The parameter "SP_A", requested at entry number 0, does not exist at all.
The default value "20" is used instead.
WARNING: The parameter "SigmoidInitialTime", requested at entry number 0, does not exist at all.
The default value "0" is used instead.
WARNING: The parameter "MaxBandCovSize", requested at entry number 0, does not exist at all.
The default value "192" is used instead.
WARNING: The parameter "NumberOfBandStructureSamples", requested at entry number 0, does not exist at all.
The default value "10" is used instead.
WARNING: The parameter "UseConstantStep", requested at entry number 0, does not exist at all.
The default value "false" is used instead.
WARNING: The parameter "MaximumStepLengthRatio", requested at entry number 0, does not exist at all.
The default value "1" is used instead.
WARNING: The parameter "MaximumStepLength", requested at entry number 0, does not exist at all.
The default value "1" is used instead.
WARNING: The parameter "NumberOfGradientMeasurements", requested at entry number 0, does not exist at all.
The default value "0" is used instead.
WARNING: The parameter "NumberOfJacobianMeasurements", requested at entry number 0, does not exist at all.
The default value "1000" is used instead.
WARNING: The parameter "NumberOfSamplesForExactGradient", requested at entry number 0, does not exist at all.
The default value "100000" is used instead.
WARNING: The parameter "SigmoidScaleFactor", requested at entry number 0, does not exist at all.
The default value "0.1" is used instead.
Elastix initialization of all components (for this resolution) took: 50 ms.
Initialization of AdvancedMattesMutualInformation metric took: 195 ms.
Starting automatic parameter estimation for AdaptiveStochasticGradientDescent ...
WARNING: The parameter "ASGDParameterEstimationMethod", requested at entry number 0, does not exist at all.
The default value "Original" is used instead.
Computing JacobianTerms ...
Computing the Jacobian terms took 0.001074s
NumberOfGradientMeasurements to estimate sigma_i: 3
Sampling gradients ...
Time spent in resolution 0 (ITK initialization and iterating): 0.216
Stopping condition: Error in metric.
Settings of AdaptiveStochasticGradientDescent in resolution 0:
( SP_a 1.000000 )
( SP_A 20.000000 )
( SP_alpha 0.602000 )
( SigmoidMax 1.000000 )
( SigmoidMin -0.800000 )
( SigmoidScale 0.000000 )
itk::ExceptionObject (00000088A7AFD7D0)
Location: "ElastixTemplate - Run()"
File: D:\Cpp_projects\elastix-5.2.0\Common\ImageSamplers\itkImageRandomSamplerSparseMask.hxx
Line: 44
Description: ITK ERROR: RandomSamplerSparseMask(000001C61599AC90): ERROR: do not call this function when no mask is supplied. When using the ImageRandomSamplerSparseMask sampler, a mask is required. Otherwise you may consider using a sampler that does not require a mask, for example, ImageRandomSampler.
Error occurred during actual registration.
Errors occurred!
This is the way we create the elastix mask from ITK Image Pointer.
elastixFixedMask = elastix::ELASTIX::ImagePointer(fixedMask.GetPointer());
Beta Was this translation helpful? Give feedback.
All reactions