nipy / mindboggle

Automated anatomical brain label/shape analysis software (+ website)
http://mindboggle.info
Other
144 stars 54 forks source link

WIP: Use updated API in VTK 6.3.0 #67

Closed nicholsn closed 8 years ago

nicholsn commented 8 years ago

This PR fixes what looks like a change to the VTK API.

When running the VTK decimate functions using version 6.3.0 installed via conda on Mac and Ubuntu I received the following error:

...
Reduced 266798 to 6486 triangular faces
  Scalar 35: 3368 vertices
('Downsampling vtk files.',)
Load "scalars" scalars from lh_1.vtk
Traceback (most recent call last):
  File "get_data.py", line 46, in <module>
    sample_rate=float(args['sample_rate']))
  File "/Users/nicholsn/Repos/roygbiv/roygbiv/__init__.py", line 105, in freesurfer_annot_to_vtks
    downsample_vtk(vtk_file, sample_rate=sample_rate)
  File "/Users/nicholsn/Repos/roygbiv/roygbiv/__init__.py", line 28, in downsample_vtk
    decimate_file(vtk_file, reduction=1 - sample_rate, output_vtk=vtk_file, save_vtk=True, smooth_steps=0)
  File "/Users/nicholsn/miniconda/envs/roygbiv/lib/python2.7/site-packages/mindboggle/guts/mesh.py", line 940, in decimate_file
    save_vtk, output_vtk)
  File "/Users/nicholsn/miniconda/envs/roygbiv/lib/python2.7/site-packages/mindboggle/guts/mesh.py", line 830, in decimate
    decimate.SetInput(polydata)
AttributeError: SetInput

Updating to use SetInputData seems to have fixed the error.

nicholsn commented 8 years ago

What do you suggest? Fall back to the old API in a try/except?

nicholsn commented 8 years ago

Ah, so this is also reflected in the cpp libs:

(roygbiv)07:47:50 (master) ~/Repos/mindboggle/surface_cpp_tools/bin$ make
Scanning dependencies of target FsSurfaceReader
[  3%] Building CXX object CMakeFiles/FsSurfaceReader.dir/FsSurfaceReader.cpp.o
/Users/nicholsn/Repos/mindboggle/surface_cpp_tools/FsSurfaceReader.cpp:109:9: error: no member named 'Update' in 'vtkPolyData'
    pd->Update();
    ~~  ^
/Users/nicholsn/Repos/mindboggle/surface_cpp_tools/FsSurfaceReader.cpp:116:10: error: no member named 'SetInput' in 'vtkPolyDataNormals'; did you mean 'SetOutput'?
    pdn->SetInput(pd);
         ^~~~~~~~
         SetOutput
/Users/nicholsn/miniconda/envs/roygbiv/include/vtk-6.3/vtkPolyDataAlgorithm.h:49:16: note: 'SetOutput' declared here
  virtual void SetOutput(vtkDataObject* d);

After correcting these, I'm now left with the following call to Update that is apparently no longer correct... Not sure what the fix is for this...

(roygbiv)08:04:49 {fix/decimate} ~/Repos/mindboggle/surface_cpp_tools/bin$ make
[  3%] Building CXX object CMakeFiles/FsSurfaceReader.dir/FsSurfaceReader.cpp.o
/Users/nicholsn/Repos/mindboggle/surface_cpp_tools/FsSurfaceReader.cpp:109:9: error: no member named 'Update' in 'vtkPolyData'
    pd->Update();
    ~~  ^
1 error generated.
make[2]: *** [CMakeFiles/FsSurfaceReader.dir/FsSurfaceReader.cpp.o] Error 1
make[1]: *** [CMakeFiles/FsSurfaceReader.dir/all] Error 2
make: *** [all] Error 2
nicholsn commented 8 years ago

Note that here is the descriptions of the api change for many data objects but not poly data here: http://www.vtk.org/Wiki/VTK/VTK_6_Migration/Removal_of_Update

bcipolli commented 8 years ago

bleah, that sucks... @binarybottle is indisposed with other projects, so may take a moment to respond.

If it's possible to do exception handling (in the cpp), or check the vtk version, that does seem the best.

nicholsn commented 8 years ago

Ya, this is nasty. @bcipolli, have you been able to successfully compile the surface_cpp_tools? I'm by no means stuck on needing to use conda or vtk 6.3, but would like to get run the basic mindboggle processing via mindboggle <subject_dir> and that explode_mindboggle_tables function.

bcipolli commented 8 years ago

I haven't tried; I used the python interface and the functions i used didn't require me to compile (beyond vtk)

nicholsn commented 8 years ago

Lucky you =) No rush, I can wait for arno's time to free up

binarybottle commented 8 years ago

Nolan -- I'm sorry it took me so long to get to this. Why not use vtk-5.10 that installs with conda install vtk for now, and contact the VTK folks to find out about polydata?

nicholsn commented 8 years ago

hey arno, with 5.10 via conda I get this error:

/Users/nicholsn/Repos/mindboggle/surface_cpp_tools/bin/geodesic_depth/GeodesicDepthMain /Users/nicholsn/mindboggle_working/bert/Mindboggle/_hemi_rh/Surface_to_vtk/rh.pial.vtk /Users/nicholsn/mindboggle_working/bert/Mindboggle/Surface_shapes/_hemi_rh/Geodesic_depth/rh.pial.geodesic_depth.vtk
Standard output:

Standard error:
dyld: Library not loaded: libvtkHybrid.5.10.dylib
  Referenced from: /Users/nicholsn/Repos/mindboggle/surface_cpp_tools/bin/geodesic_depth/GeodesicDepthMain
  Reason: image not found
Return code: -5
Interface CommandLine failed to run.
Interface Function failed to run.
njhunsak commented 8 years ago

Oh same error I've got and have yet to solve.

Naomi

On Nov 2, 2015, at 7:14 PM, Nolan Nichols notifications@github.com wrote:

hey arno, with 5.10 via conda I get this error:

/Users/nicholsn/Repos/mindboggle/surface_cpp_tools/bin/geodesic_depth/GeodesicDepthMain /Users/nicholsn/mindboggle_working/bert/Mindboggle/_hemi_rh/Surface_to_vtk/rh.pial.vtk /Users/nicholsn/mindboggle_working/bert/Mindboggle/Surface_shapes/_hemi_rh/Geodesic_depth/rh.pial.geodesic_depth.vtk Standard output:

Standard error: dyld: Library not loaded: libvtkHybrid.5.10.dylib Referenced from: /Users/nicholsn/Repos/mindboggle/surface_cpp_tools/bin/geodesic_depth/GeodesicDepthMain Reason: image not found Return code: -5 Interface CommandLine failed to run. Interface Function failed to run. — Reply to this email directly or view it on GitHub.

binarybottle commented 8 years ago

Perhaps it's an issue with conda/vtk on Mac vs. Linux?

njhunsak commented 8 years ago

I get the same error on Linux and Mac.

On Nov 2, 2015, at 8:09 PM, Arno Klein notifications@github.com wrote:

Perhaps it's an issue with conda/vtk on Mac vs. Linux?

— Reply to this email directly or view it on GitHub https://github.com/nipy/mindboggle/pull/67#issuecomment-153229569.

binarybottle commented 8 years ago

Whew! I followed guidelines for VTK 6 migration on: http://www.vtk.org/Wiki/VTK/Build_System_Migration and believe I was able to make all necessary changes, as the C++ code compiles fine again, with the newest Miniconda's VTK 6.3. I have yet to perform a test run on the entire mindboggle pipeline, but working on it...