Shapeworks: Error in reflectMeshes when running femur and femur_cut use case

Created on 18 Feb 2021  ·  12Comments  ·  Source: SCIInstitute/ShapeWorks

Tried to run femur and femur_cut use case:

  1. Tiny test works fine python RunUseCase.py --use_case femur --tiny_test
  2. Use case runs well if you use --skip_grooming
  3. Use case fails when you run python RunUseCase.py --use_case femur and python RunUseCase.py --use_case femur_cut with the error:
Step 2. Groom - Data Pre-processingInput filename: Output/femur/femur-v0/meshes/m09_R_femur.ply
Output filename: Output/femur/groomed/reflected/segmentations/m09_R_femur.reflect.ply
Traceback (most recent call last):
  File "RunUseCase.py", line 79, in <module>
    module.Run_Pipeline(args)
  File "/home/sci/iyerkrithika/ShapeWorks/Examples/Python/femur.py", line 219, in Run_Pipeline
    reflectedFiles_mesh = reflectMeshes(groomDir + 'reflected', files_mesh, reference_side)
  File "/home/sci/iyerkrithika/ShapeWorks/Examples/Python/GroomUtils.py", line 344, in reflectMeshes
    mesh.reflect(X, mesh.center()).write(seg_out)
ValueError: vector::reserve
QA bug

Most helpful comment

@iyerkrithika21 I think the crop function works fine. Increase the padding.

All 12 comments

Running this on the latest from this branch, I get:

Input filename: Output/femur/groomed/centered/segmentations/m12_R_femur.reflect.isores.pad.com.center.nrrd
Output filename: Output/femur/groomed/aligned/m12_R_femur.reflect.isores.pad.com.center.aligned.nrrd
Input filename: Output/femur/groomed/centered/segmentations/m13_R_femur.reflect.isores.pad.com.center.nrrd
Output filename: Output/femur/groomed/aligned/m13_R_femur.reflect.isores.pad.com.center.aligned.nrrd
ERROR: In ../Common/DataModel/vtkIterativeClosestPointTransform.cxx, line 270
vtkIterativeClosestPointTransform (0x7ff2ceeb98c0): Can't execute with nullptr or empty input

Input filename: Output/femur/groomed/centered/segmentations/m14_R_femur.reflect.isores.pad.com.center.nrrd
Output filename: Output/femur/groomed/aligned/m14_R_femur.reflect.isores.pad.com.center.aligned.nrrd
Input filename: Output/femur/groomed/centered/segmentations/m15_R_femur.reflect.isores.pad.com.center.nrrd
Output filename: Output/femur/groomed/aligned/m15_R_femur.reflect.isores.pad.com.center.aligned.nrrd

Is this a problem?

I ran:

python RunUseCase.py --use_case femur

I answered 'yes' when it asks about rasterizing isotropic.

It ended with:


Input filename: Output/femur/groomed/clipped_segmentations/m03_L_femur.isores.pad.com.center.aligned.clipped.nrrd
Output filename: Output/femur/groomed/cropped/segmentations/m03_L_femur.isores.pad.com.center.aligned.clipped.cropped.nrrd
Traceback (most recent call last):
  File "RunUseCase.py", line 79, in <module>
    module.Run_Pipeline(args)
  File "/Users/amorris/sci/data/Examples/Python/femur.py", line 299, in Run_Pipeline
    croppedFiles_segmentations = applyCropping(groomDir + "cropped/segmentations", clippedFiles_segmentations, groomDir + "clipped_segmentations/*.nrrd")
  File "/Users/amorris/sci/data/Examples/Python/GroomUtils.py", line 225, in applyCropping
    img.crop(region).write(outname)
RuntimeError: /Users/amorris/sci/shapeworks/dependencies/build/ITK/Modules/Core/Common/src/itkDataObject.cxx:385:
Requested region is (at least partially) outside the largest possible region.

I ran:

python RunUseCase.py --use_case femur

I answered 'yes' when it asks about rasterizing isotropic.

It ended with:


Input filename: Output/femur/groomed/clipped_segmentations/m03_L_femur.isores.pad.com.center.aligned.clipped.nrrd
Output filename: Output/femur/groomed/cropped/segmentations/m03_L_femur.isores.pad.com.center.aligned.clipped.cropped.nrrd
Traceback (most recent call last):
  File "RunUseCase.py", line 79, in <module>
    module.Run_Pipeline(args)
  File "/Users/amorris/sci/data/Examples/Python/femur.py", line 299, in Run_Pipeline
    croppedFiles_segmentations = applyCropping(groomDir + "cropped/segmentations", clippedFiles_segmentations, groomDir + "clipped_segmentations/*.nrrd")
  File "/Users/amorris/sci/data/Examples/Python/GroomUtils.py", line 225, in applyCropping
    img.crop(region).write(outname)
RuntimeError: /Users/amorris/sci/shapeworks/dependencies/build/ITK/Modules/Core/Common/src/itkDataObject.cxx:385:
Requested region is (at least partially) outside the largest possible region.

Increasing the padding to 30 on line 259 in femur.py does not produce this error.
I will discuss this with @archanasri to find what is going wrong with the crop function.

@iyerkrithika21 I think the crop function works fine. Increase the padding.

Running this on the latest from this branch, I get:

Input filename: Output/femur/groomed/centered/segmentations/m12_R_femur.reflect.isores.pad.com.center.nrrd
Output filename: Output/femur/groomed/aligned/m12_R_femur.reflect.isores.pad.com.center.aligned.nrrd
Input filename: Output/femur/groomed/centered/segmentations/m13_R_femur.reflect.isores.pad.com.center.nrrd
Output filename: Output/femur/groomed/aligned/m13_R_femur.reflect.isores.pad.com.center.aligned.nrrd
ERROR: In ../Common/DataModel/vtkIterativeClosestPointTransform.cxx, line 270
vtkIterativeClosestPointTransform (0x7ff2ceeb98c0): Can't execute with nullptr or empty input

Input filename: Output/femur/groomed/centered/segmentations/m14_R_femur.reflect.isores.pad.com.center.nrrd
Output filename: Output/femur/groomed/aligned/m14_R_femur.reflect.isores.pad.com.center.aligned.nrrd
Input filename: Output/femur/groomed/centered/segmentations/m15_R_femur.reflect.isores.pad.com.center.nrrd
Output filename: Output/femur/groomed/aligned/m15_R_femur.reflect.isores.pad.com.center.aligned.nrrd

Is this a problem?

@akenmorris what did you run from the command line?

Running this on the latest from this branch, I get:

Input filename: Output/femur/groomed/centered/segmentations/m12_R_femur.reflect.isores.pad.com.center.nrrd
Output filename: Output/femur/groomed/aligned/m12_R_femur.reflect.isores.pad.com.center.aligned.nrrd
Input filename: Output/femur/groomed/centered/segmentations/m13_R_femur.reflect.isores.pad.com.center.nrrd
Output filename: Output/femur/groomed/aligned/m13_R_femur.reflect.isores.pad.com.center.aligned.nrrd
ERROR: In ../Common/DataModel/vtkIterativeClosestPointTransform.cxx, line 270
vtkIterativeClosestPointTransform (0x7ff2ceeb98c0): Can't execute with nullptr or empty input

Input filename: Output/femur/groomed/centered/segmentations/m14_R_femur.reflect.isores.pad.com.center.nrrd
Output filename: Output/femur/groomed/aligned/m14_R_femur.reflect.isores.pad.com.center.aligned.nrrd
Input filename: Output/femur/groomed/centered/segmentations/m15_R_femur.reflect.isores.pad.com.center.nrrd
Output filename: Output/femur/groomed/aligned/m15_R_femur.reflect.isores.pad.com.center.aligned.nrrd

Is this a problem?

@akenmorris what did you run from the command line?

@archanasri I get this when I run python RunUseCase.py --use_case femur --groom_images
I see this error in the rigid alignment step.

I believe I just ran:

python RunUseCase.py --use_case femur

The full use case without grooming images is now fixed on the femur_reflect_fix branch.
When you run the full use case with the --groom_images tag, then it gives the alignment error Alan mentioned above because the reflected segmentations are all zero. So anatomyPairsToSingles() in GroomUtils.py isn't working... @archanasri can you help us look at this?

@jadie1 @iyerkrithika21 could you try this:
img1.reflect(Axis.X).write(img_out) on line 312 of GroomUtils and
mesh.reflect(Axis.X, center).write(seg_out) on line 315 of GroomUtils

@jadie1 @iyerkrithika21 could you try this:
img1.reflect(Axis.X).write(img_out) on line 312 of GroomUtils and
mesh.reflect(Axis.X, center).write(seg_out) on line 315 of GroomUtils

The reflected segmentations are still all zeros.
Saw the same error in the alignment.

Working when grooming without images as of PR #1030
Now fixing when grooming with images on branch reflect_fix

Fixed in PR #1040

Was this page helpful?
5 / 5 - 1 ratings

Related issues

akenmorris picture akenmorris  ·  16Comments

cchriste picture cchriste  ·  3Comments

akenmorris picture akenmorris  ·  32Comments

akenmorris picture akenmorris  ·  23Comments

iyerkrithika21 picture iyerkrithika21  ·  7Comments