Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

One mode ellipsoid fix #1162

Merged
merged 16 commits into from Mar 19, 2021
Merged

One mode ellipsoid fix #1162

merged 16 commits into from Mar 19, 2021

Conversation

akenmorris
Copy link
Contributor

@akenmorris akenmorris commented Mar 18, 2021

This PR changes all ellipsoid examples to use new ellipsoid data generated via the shape cohort generator which only varies along the x radius. Addresses issue #1133

Testing required:

  • ellipsoid use case
  • ellipsoid_fd use case
  • ellipsoid_mesh use case
  • ellipsoid_cut use case
  • getting-started-with-segmentations.ipynb
  • getting-started-with-meshes.ipynb
  • getting-started-with-exploring-segmentations.ipynb
  • getting-started-with-grooming-segmentations.ipynb
  • getting-started-with-shape-cohort-generation.ipynb

The new data on the portal (ellipsoid_1mode and ellipsoid_1mode_aligned) should have the expected output from all use cases.

@akenmorris akenmorris mentioned this pull request Mar 18, 2021
9 tasks
@akenmorris
Copy link
Contributor Author

image

This is the basic ellipsoid run.

Any idea why the spacing is so non-uniform?

@akenmorris
Copy link
Contributor Author

akenmorris commented Mar 18, 2021

FYI, the default parameters in Studio for the groomed data, which require only 22 seconds for me to run, looks like this:

image

@jadie1
Copy link
Contributor

jadie1 commented Mar 18, 2021

FYI, the default parameters in Studio for the groomed data, which require only 22 seconds for me to run, looks like this:

Should I change the use case optimize params to the studio default?

@akenmorris
Copy link
Contributor Author

Well, it's an important point for people to see what's going on:

Here are roughly the parameters from the python file, with the exception of the recompute_regularization_interval that I don't know why we are using 2 instead of 1 here.

In any case, notice how during the optimization iterations, the sampling goes bad:

ellipsoid.mp4

If you drop the relative weighting from 15 to 1, it's much improved, but as far as I can tell, the real thing ruining this is the use of normals. I'm guessing this wouldn't be the case if the surface was smoother. @sheryjoe , what do you think?

@akenmorris
Copy link
Contributor Author

akenmorris commented Mar 18, 2021

Here is the result with normals off:

image

Much better.

My guess is that since these ellipsoids are not smooth, the correspondence of the normals is basically trying to match the bumps (noise) between shapes, and this is causing problems. @sheryjoe , what do you think?

@akenmorris
Copy link
Contributor Author

My conclusion here is that this data is not properly groomed (smoothed enough) to use normals. Do we want to change the grooming or just disable normals and move on? @sheryjoe ?

@jadie1
Copy link
Contributor

jadie1 commented Mar 18, 2021

@akenmorris That makes sense. I discussed with Shireen and she agreed we shouldn't use normals. Decreasing the relative weighting makes sense too for this simple example. So we need to update those parameters for all ellipsoid use cases, update the shape models on the portal, and update the documentation.

@akenmorris
Copy link
Contributor Author

@jadie1 , are you already working on this or should I take care of it?

@jadie1
Copy link
Contributor

jadie1 commented Mar 19, 2021

I did not get to it today, you are welcome to take care of it or I can do it in the morning.

@akenmorris
Copy link
Contributor Author

akenmorris commented Mar 19, 2021

Ok, I updated the params, particles in the zip file and on the portal.

@akenmorris
Copy link
Contributor Author

getting-started-with-grooming-segmentations.ipynb crashes for me here:

shapeSeg = shapeSegList[10]
itkw.view( image          = sw2vtkImage(shapeSeg),
           slicing_planes = True,
           axes           = True,
           rotate         = True,
           interpolation  = True)

Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000003
Exception Note: EXC_CORPSE_NOTIFY

VM Regions Near 0x3:
-->
__TEXT 0000000106913000-0000000106be4000 [ 2884K] r-x/r-x SM=COW /Users/USER//.7

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libsystem_kernel.dylib 0x00007fff6b02733a __pthread_kill + 10
1 libsystem_pthread.dylib 0x00007fff6b0e3e60 pthread_kill + 430
2 libsystem_c.dylib 0x00007fff6af3e93e raise + 26
3 libsystem_platform.dylib 0x00007fff6b0d85fd _sigtramp + 29
4 ??? 000000000000000000 0 + 0
5 libvnl.dylib 0x000000010c734e6b vnl_vector::operator=(vnl_vector const&) + 139
6 _ITKCommonPython.so 0x000000013c7e718b vnl_vector::operator=(vnl_vector&&) + 65
7 _ITKCommonPython.so 0x000000013c6b8c9d 0x13b9dd000 + 13483165
8 _ITKCommonPython.so 0x000000013c443165 0x13b9dd000 + 10903909
9 _ITKCommonPython.so 0x000000013c83b1a7 itk::ProcessObject::UpdateOutputInformation() + 339
10 _ITKCommonPython.so 0x000000013c0578fe 0x13b9dd000 + 6793470
11 _ITKImageGridPython.so 0x0000000140fe3619 itk::ProcessObject::UpdateOutputInformation() + 117
12 _ITKImageGridPython.so 0x0000000140fe3ebc itk::ProcessObject::UpdateLargestPossibleRegion() + 18
13 _ITKCommonPython.so 0x000000013bce126b 0x13b9dd000 + 3162731

@iyerkrithika21
Copy link
Contributor

iyerkrithika21 commented Mar 19, 2021

getting-started-with-grooming-segmentations.ipynb crashes for me here:

For me it is crashing at:

<ipython-input-3-b1545fcc3f94> in save_images(outDir, swImageList, swImageNames, extension, compressed, verbose)
     19         filename = Path(outDir + curName + '.' + extension)
     20         if verbose:
---> 21             print('Writing: ' + filename)
     22         if not os.path.exists(os.path.dirname(filename)):
     23             os.makedirs(os.path.dirname(filename))

TypeError: can only concatenate str (not "PosixPath") to str

I thought #1141 ,#1120 and #1116 solved this.

@cchriste
Copy link
Contributor

getting-started-with-grooming-segmentations.ipynb crashes for me here:

This is disturbing, since I presume we're up to date with the most recent release_v6.0c branch, and the error is suspiciously close to sw2vtkImage. Is it possible the image being passed to that function is broken? Has the function been changed in the past few days? It should be separated out and debugged from there. Please let me know if you need help.

@akenmorris
Copy link
Contributor Author

@iyerkrithika21 , I just barely merged in changes from release_6.0c to this branch. This might fix your issue. It didn't fix mine.

@iyerkrithika21
Copy link
Contributor

After the merge, the notebook ran without errors on Linux.

@akenmorris
Copy link
Contributor Author

getting-started-with-grooming-segmentations.ipynb worked on windows for me, so maybe my mac has an out of date conda dependency or something.

@akenmorris
Copy link
Contributor Author

akenmorris commented Mar 19, 2021

getting-started-with-shape-cohort-generation.ipynb didn't work for me on windows. It couldn't find the shapeworks library. The other notebooks can.

@jadie1
Copy link
Contributor

jadie1 commented Mar 19, 2021

getting-started-with-grooming-segmentations.ipynb is crashing for me here:

# ... and visualize the mean shape
meanShape_vtk = pv.wrap(meanShape)

print('mean shape')
itkw.view( #image          = meanShape_vtk, # for orthoginal image plane
           label_image    = meanShape_vtk,  # for volume rendering segmentation
           slicing_planes = True,
           axes           = True,
           rotate         = True, # enable auto rotation
           interpolation  = True
         )

TemplateTypeError: itk.ExtractImageFilter is not wrapped for input type None.

meanShape_vtk is not 'None' though...

@jadie1
Copy link
Contributor

jadie1 commented Mar 19, 2021

All of the other notebooks ran fine for me on Linux.

@akenmorris
Copy link
Contributor Author

akenmorris commented Mar 19, 2021

I fixed the path stuff for windows and now I get "ERROR: ShapeCohortGen library failed to import".

I just re-installed it using pip commands from conda_installs.bat, but still no luck. I don't see anything on the terminal to indicate what the error is.

Ok, importing from the command line, it seems I'm missing trimesh. Back to conda_installs again.

Update: well, conda_installs can't find it:

PackagesNotFoundError: The following packages are not available from current channels:

- trimesh=3.8.15

Any suggestions?

So for conda_installs.sh, we are just asking for "trimesh" and conda_installs.bat we ask for trimesh=3.8.15

I noticed in the windows conda_installs.sh from GH actions that it's getting 3.9.9. I asked for just 'trimesh' on windows and it gave me 3.9.8.

@akenmorris akenmorris merged commit 9adf785 into release_v6.0c Mar 19, 2021
@akenmorris akenmorris deleted the one_mode_ellipsoid-fix branch March 19, 2021 18:39
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.

None yet

4 participants