Skip to content

Conversation

allywarner
Copy link
Contributor

Updating Seg3D to ITK 5.1.0 to fix bugs.

@dzenanz
Copy link
Contributor

dzenanz commented Sep 24, 2020

A WIP is in my fork: https://github.com/dzenanz/Seg3D/tree/itk5migration. I will continue working on this tomorrow. I have some unrelated link errors for boost, such as 13>LINK : fatal error LNK1104: cannot open file 'M:\Dev\Seg3D-vs17sb\Externals\Source\Boost_external\lib\libboost_atomic-mt-gyd.lib' [M:\Dev\Seg3D-vs17sb\Seg3D\Core\Action\Tests\Core_Action_Tests.vcxproj]. Is building in Debug mode supposed to work?

@dzenanz
Copy link
Contributor

dzenanz commented Sep 25, 2020

I am stuck at this possible bug in ITK. The boost link errors are gone in RelWithDebInfo build. The only other build error I have is related to HDF5:

M:\Dev\Seg3D-vs17sb\Externals\Install\ITK_external\include\ITK-5.1\itk_H5Cpp.h(27): fatal error C1083: Cannot open include file: 'itkhdf5/cpp/H5Cpp.h': No such file or directory (compiling source file M:\Dev\Seg3D\src\Application\LayerIO\Matlab73LayerImporter.cc) [M:\Dev\Seg3D-vs17sb\Seg3D\Application\LayerIO\Application_LayerIO.vcxproj]

Pointing to ITK's build directory instead of install might help with that. @allywarner do you get the same errors?

@allywarner
Copy link
Contributor Author

@dzenanz Debug mode is supposed to work!I haven't seen that error before. Were you able to fix it?

The other build error in reference to HDF5 is the error I'm gettting trying to build with ITK5. We can also look at my or your build together if you like!

@Leengit
Copy link
Contributor

Leengit commented Oct 1, 2020

Incorporating the changes from @dzenanz (who incorporated changes from @allywarner), I have a WIP at Leengit/Seg3D branch itk5migration. There I was able to address a number of build-stopping errors (using gcc-8 on Ubuntu 20.04):

  1. Missing typename directives in declarations.
  2. Confusion between long and long long
  3. Use of itkMutexLock instead of std::mutex.
  4. Failure to include <itkMacro.h>
  5. Use of ComposeRGBImageFilter instead of ComposeImageFilter
  6. Use of NULL instead of nullptr
  7. Use of vcl_sqrt instead of std::sqrt, etc.
  8. itk::MultiThreader --> itk::MultiThreaderBase
  9. Removal of inappropriate Seg3D:: explicit qualification

Outstanding is only the HDF5 error reported above. I believe that the include directory tree includes the path

Seg3D-build/Externals/Install/ITK_external/include/ITK-5.1/

... in a situation where it should be looking to

Seg3D-build/Externals/Source/ITK_external/Modules/ThirdParty/HDF5/src/

... but I haven't yet figured out how to fix that.

@dzenanz
Copy link
Contributor

dzenanz commented Oct 2, 2020

There are some more errors on Visual Studio. Log from current WIP:

1>------ Build started: Project: Application_LayerIO, Configuration: RelWithDebInfo x64 ------
2>------ Build started: Project: Application_Tools, Configuration: RelWithDebInfo x64 ------
3>------ Skipped Build: Project: NightlyMemoryCheck, Configuration: RelWithDebInfo x64 ------
3>Project not selected to build for this solution configuration 
4>------ Skipped Build: Project: RUN_TESTS, Configuration: RelWithDebInfo x64 ------
4>Project not selected to build for this solution configuration 
5>------ Skipped Build: Project: Experimental, Configuration: RelWithDebInfo x64 ------
5>Project not selected to build for this solution configuration 
6>------ Skipped Build: Project: Continuous, Configuration: RelWithDebInfo x64 ------
6>Project not selected to build for this solution configuration 
7>------ Skipped Build: Project: Nightly, Configuration: RelWithDebInfo x64 ------
7>Project not selected to build for this solution configuration 
1>Matlab73LayerImporter.cc
1>M:\Dev\Seg3D\src\Application\LayerIO\Matlab73LayerImporter.cc(32,10): fatal error C1083: Cannot open include file: 'itkhdf5/H5LTpublic.h': No such file or directory
2>ActionSpeedline.cc
1>Done building project "Application_LayerIO.vcxproj" -- FAILED.
8>------ Build started: Project: Application_LayerIO_Tests, Configuration: RelWithDebInfo x64 ------
8>LINK : fatal error LNK1104: cannot open file '..\..\RelWithDebInfo\Application_LayerIO.lib'
8>Done building project "Application_LayerIO_Tests.vcxproj" -- FAILED.
2>M:\Dev\Seg3D-vs19sb\Externals\Install\ITK_external\include\ITK-5.2\itkPriorityQueueContainer.hxx(94,14): error C2664: 'itk::Index<2>::Index(itk::Index<2> &&)': cannot convert argument 1 from 'int' to 'const itk::Index<2> &'
2>M:\Dev\Seg3D-vs19sb\Externals\Install\ITK_external\include\ITK-5.2\itkPriorityQueueContainer.hxx(97,1): message : Reason: cannot convert from 'int' to 'const itk::Index<2>'
2>M:\Dev\Seg3D-vs19sb\Externals\Install\ITK_external\include\ITK-5.2\itkPriorityQueueContainer.hxx(97,1): message : No constructor could take the source type, or constructor overload resolution was ambiguous
2>M:\Dev\Seg3D-vs19sb\Externals\Install\ITK_external\include\ITK-5.2\itkIndex.h(490,1): message : see declaration of 'itk::Index<2>::Index'
2>M:\Dev\Seg3D-vs19sb\Externals\Install\ITK_external\include\ITK-5.2\itkPriorityQueueContainer.hxx(94): message : while compiling class template member function 'itk::MinPriorityQueueElementWrapper<itk::Index<2>,itk::LiveWireImageFunction<TYPED_IMAGE_TYPE_2D>::RealType,itk::LiveWireImageFunction<TYPED_IMAGE_TYPE_2D>::ElementIdentifier>::MinPriorityQueueElementWrapper(void)'
2>M:\Dev\Seg3D-vs19sb\Externals\Install\ITK_external\include\ITK-5.2\itkPriorityQueueContainer.hxx(272): message : see reference to function template instantiation 'itk::MinPriorityQueueElementWrapper<itk::Index<2>,itk::LiveWireImageFunction<TYPED_IMAGE_TYPE_2D>::RealType,itk::LiveWireImageFunction<TYPED_IMAGE_TYPE_2D>::ElementIdentifier>::MinPriorityQueueElementWrapper(void)' being compiled
2>M:\Dev\Seg3D-vs19sb\Externals\Install\ITK_external\include\ITK-5.2\itkPriorityQueueContainer.hxx(105): message : while compiling class template member function 'itk::MinPriorityQueueElementWrapper<itk::Index<2>,itk::LiveWireImageFunction<TYPED_IMAGE_TYPE_2D>::RealType,itk::LiveWireImageFunction<TYPED_IMAGE_TYPE_2D>::ElementIdentifier>::MinPriorityQueueElementWrapper(itk::Index<2>,float)'
2>M:\Dev\Seg3D\src\Core\ITKLiveWire\itkLiveWireImageFunction.hxx(218): message : see reference to function template instantiation 'itk::MinPriorityQueueElementWrapper<itk::Index<2>,itk::LiveWireImageFunction<TYPED_IMAGE_TYPE_2D>::RealType,itk::LiveWireImageFunction<TYPED_IMAGE_TYPE_2D>::ElementIdentifier>::MinPriorityQueueElementWrapper(itk::Index<2>,float)' being compiled
2>M:\Dev\Seg3D\src\Core\ITKLiveWire\itkLiveWireImageFunction.hxx(218): message : see reference to class template instantiation 'itk::MinPriorityQueueElementWrapper<itk::Index<2>,itk::LiveWireImageFunction<TYPED_IMAGE_TYPE_2D>::RealType,itk::LiveWireImageFunction<TYPED_IMAGE_TYPE_2D>::ElementIdentifier>' being compiled
2>M:\Dev\Seg3D\src\Core\ITKLiveWire\itkLiveWireImageFunction.hxx(130): message : while compiling class template member function 'void itk::LiveWireImageFunction<TYPED_IMAGE_TYPE_2D>::GeneratePathDirectionImage(void)'
2>M:\Dev\Seg3D\src\Core\ITKLiveWire\itkLiveWireImageFunction.h(168): message : see reference to function template instantiation 'void itk::LiveWireImageFunction<TYPED_IMAGE_TYPE_2D>::GeneratePathDirectionImage(void)' being compiled
2>M:\Dev\Seg3D\src\Application\Tools\Actions\ActionSpeedline.cc(195): message : see reference to class template instantiation 'itk::LiveWireImageFunction<TYPED_IMAGE_TYPE_2D>' being compiled
2>M:\Dev\Seg3D\src\Application\Tools\Actions\ActionSpeedline.cc(171): message : see reference to function template instantiation 'void Seg3D::ActionSpeedlineAlgo::typed_run_filter<signed char>(void)' being compiled
2>Done building project "Application_Tools.vcxproj" -- FAILED.
9>------ Build started: Project: CreateLargeVolume, Configuration: RelWithDebInfo x64 ------
10>------ Build started: Project: Seg3D2, Configuration: RelWithDebInfo x64 ------
9>LINK : fatal error LNK1104: cannot open file '..\Application\Tools\RelWithDebInfo\Application_Tools.lib'
9>Done building project "CreateLargeVolume.vcxproj" -- FAILED.
10>LINK : fatal error LNK1181: cannot open input file '..\Application\Tools\RelWithDebInfo\Application_Tools.lib'
10>Done building project "Seg3D2.vcxproj" -- FAILED.
11>------ Skipped Build: Project: PACKAGE, Configuration: RelWithDebInfo x64 ------
11>Project not selected to build for this solution configuration 
12>------ Skipped Build: Project: INSTALL, Configuration: RelWithDebInfo x64 ------
12>Project not selected to build for this solution configuration 
========== Build: 0 succeeded, 5 failed, 57 up-to-date, 7 skipped ==========

@allywarner
Copy link
Contributor Author

@dzenanz It's common to have many errors when upgrading Seg3D to a new ITK version. The error I'm most concerned about at the moment is the HDF5 error.

@Leengit
Copy link
Contributor

Leengit commented Oct 5, 2020

I have added commits to Leengit/Seg3D branch itk5migration to address more ITK upgrade issues. @dzenanz is making changes to ITK (via the enableH5HL branch) to address the H5HL problems.

@Leengit
Copy link
Contributor

Leengit commented Oct 7, 2020

I would like to contribute the commits on my Leengit/Seg3D branch itk5migration. Given this pull request already in progress and several branches owned by different parties, I don'tk now how to do that. Please advise.

@dzenanz
Copy link
Contributor

dzenanz commented Oct 7, 2020

@Leengit When we get somebody's fork building, it is easy to have that person make a PR. For now, we can just cherry-pick each other's commits as we have done so far.

With my fork, I get past #include hdf5 error. Improvements come from changes done in enableH5HL branch in ITK. Here is my build log:

1>------ Build started: Project: Seg3D2, Configuration: RelWithDebInfo x64 ------
2>------ Skipped Build: Project: NightlyMemoryCheck, Configuration: RelWithDebInfo x64 ------
2>Project not selected to build for this solution configuration 
3>------ Skipped Build: Project: RUN_TESTS, Configuration: RelWithDebInfo x64 ------
3>Project not selected to build for this solution configuration 
4>------ Skipped Build: Project: Experimental, Configuration: RelWithDebInfo x64 ------
4>Project not selected to build for this solution configuration 
5>------ Skipped Build: Project: Continuous, Configuration: RelWithDebInfo x64 ------
5>Project not selected to build for this solution configuration 
6>------ Skipped Build: Project: Nightly, Configuration: RelWithDebInfo x64 ------
6>Project not selected to build for this solution configuration 
1>Application_Tools.lib(ActionSpeedline.obj) : error LNK2001: unresolved external symbol "public: static struct itk::Index<2> const itk::NumericTraits<struct itk::Index<2> >::Zero" (?Zero@?$NumericTraits@U?$Index@$01@itk@@@itk@@2U?$Index@$01@2@B)
1>Application_LayerIO.lib(Matlab73LayerImporter.obj) : error LNK2019: unresolved external symbol H5LTget_dataset_ndims referenced in function "public: bool __cdecl Seg3D::Matlab73LayerImporterPrivate::scan_mat_array(__int64,char const *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &)" (?scan_mat_array@Matlab73LayerImporterPrivate@Seg3D@@QEAA_N_JPEBDAEAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
1>Application_LayerIO.lib(Matlab73LayerImporter.obj) : error LNK2019: unresolved external symbol H5LTget_dataset_info referenced in function "public: bool __cdecl Seg3D::Matlab73LayerImporterPrivate::scan_mat_array(__int64,char const *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &)" (?scan_mat_array@Matlab73LayerImporterPrivate@Seg3D@@QEAA_N_JPEBDAEAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
1>Application_LayerIO.lib(Matlab73LayerImporter.obj) : error LNK2019: unresolved external symbol H5LTget_attribute_string referenced in function "public: bool __cdecl Seg3D::Matlab73LayerImporterPrivate::scan_mat_object(__int64,enum H5O_type_t,class H5::Group &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &)" (?scan_mat_object@Matlab73LayerImporterPrivate@Seg3D@@QEAA_N_JW4H5O_type_t@@AEAVGroup@H5@@AEAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
1>M:\Dev\Seg3D-vs19sb\Seg3D\RelWithDebInfo\Seg3D2.exe : fatal error LNK1120: 4 unresolved externals
1>Done building project "Seg3D2.vcxproj" -- FAILED.
7>------ Skipped Build: Project: PACKAGE, Configuration: RelWithDebInfo x64 ------
7>Project not selected to build for this solution configuration 
8>------ Skipped Build: Project: INSTALL, Configuration: RelWithDebInfo x64 ------
8>Project not selected to build for this solution configuration 
========== Build: 0 succeeded, 1 failed, 61 up-to-date, 7 skipped ==========

@Leengit
Copy link
Contributor

Leengit commented Oct 7, 2020

@dzenanz, the error you are seeing means that my fix to use m_Element(NumericTraits<TElement>::ZeroValue()) instead of m_Element(0) in ITK/Modules/Core/Common/include/itkPriorityQueueContainer.hxx is not working for all configurations when TElement is itk::Index<2>.

@dzenanz
Copy link
Contributor

dzenanz commented Oct 8, 2020

My fork now build successfully. But speedline tool does not seem to work (it works in 2.2.1 I downloaded from the website). It looks like it was refactored since, but I cannot get it to work. Maybe I don't know how to use it? Or it was broken by fixes to priority queue in ITK?

@allywarner
Copy link
Contributor Author

@dzenanz @jessdtate What happens when you try to use speedline?

@Leengit
Copy link
Contributor

Leengit commented Oct 8, 2020

The fix to itk::Modules/Core/Common/include/itkPriorityQueueContainer.hxx (draft pull request InsightSoftwareConsortium/ITK#2048) is intended to fix a problem uncovered when I build Seg3D. The fix works on my configuration, but if you are seeing problems then we've still got problems.

@dzenanz
Copy link
Contributor

dzenanz commented Oct 8, 2020

@Leengit it builds for me too.

@allywarner when I click "Fill", there is no segmentation appearing. Also when I place control points, the line does not appear.

@allywarner
Copy link
Contributor Author

@dzenanz I'll build your fork and test it out.

@allywarner
Copy link
Contributor Author

@dzenanz I've done some testing on OSX 10.14.6 and I was able to get control points, but not able to get a segmentation. I'm going to take a look into it this week!

@dzenanz
Copy link
Contributor

dzenanz commented Oct 15, 2020

Any updates @allywarner?

@dzenanz
Copy link
Contributor

dzenanz commented Oct 28, 2020

@allywarner, feedback?

@allywarner
Copy link
Contributor Author

allywarner commented Oct 29, 2020

@allywarner, feedback?

@dzenanz, The ExtractImageFilter needed SetDirectionCollapseToStrategy() to be able to move forward! There was a lousy try catch in Seg3D that wasn't throwing any exception at all. So I've set that and so far it has the same behavior as the release version. For me, the release version of Speedline doesn't work on my machine (Windows and OSX 10.14.6). @jessdtate says that it works for him on OSX 10.12. Speedline is using Livewire segmentation and it claims that the anchor is outside of the region therefore it's not calculating any paths between the selected points.

@allywarner
Copy link
Contributor Author

@dzenanz It does work! Wahoo! I do have some SQL errors though so I'm going to look through those.

@allywarner allywarner changed the title ITK 5.1.0 upgrade ITK 5.2 upgrade Oct 30, 2020
@allywarner
Copy link
Contributor Author

@dzenanz this PR should build and not have errors as far as I know. Will the H5HL branch be merged into master?

case Core::DataType::UINT_E:
buffer_size = sizeof( int );
break;
case Core::DataType::LONGLONG_E:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At least, this commit should be called Dženan's and Lee's changes. But I prefer you cherry-picking all our commits with their messages (possibly squashing some, but not all commits).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I'm so sorry! I didn't mean to not give credit to Lee! I really appreciate the help. I will cherry pick in the future!

ENDIF()

SET(itk_GIT_TAG "origin/itk5.1.0")
SET(itk_GIT_TAG "enableH5HL")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just merged the commit from H5HL branch into master, so this should be changed to master until v5.2.0 is tagged.

"-DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>"
"-DITK_BUILD_DEFAULT_MODULES:BOOL=OFF"
"-DITKV3_COMPATIBILITY:BOOL=OFF"
"-DITKV4_COMPATIBILITY:BOOL=ON"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The combination of settings here is indicative of full update to ITKv4, and minimal update to ITKv5. For future proofing, we should finish migration to ITKv5. That should be done in a new PR. Possibly after allowing a week or so of use to see if there are any immediate bugs/changes caused by this PR.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Turning on removal of legacy code did not require further changes on my machine. I created an alternative PR with full commit history in #382.

@dzenanz dzenanz mentioned this pull request Nov 2, 2020
@allywarner allywarner closed this Nov 3, 2020
@dcwhite dcwhite deleted the itk-5.1.0 branch September 27, 2021 22:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants