Skip to content

Commit

Permalink
ENH: FEM refactoring as contracted for ITKv4
Browse files Browse the repository at this point in the history
This commit makes the FEM framework more ITK like. There is
now a FEMObject to define the finite element problem and
the Solver derives from ProcessObject. Substantially more
testing is performed on this code. Much of this work
was contributed by Kiran Shivanna.

UPD:   All tests now pass except itkFEMC0TriangularElement-Quadratic.
       This result needs to be revied for numerical differences between Solvers
UPD:   Currently disable FEM registration test. This needs to be refoctored
UPD:   Updated regression tests. Removed FEM Registration tests
UPD:   Replaced explicit New() with itkSimpleNewMacro()
UPD:   Added the itkFEMRegistrationFilter and updated tests
UPD:   Fixed a bug in the FEM Registration filter test
UPD:   Added landmarks to regiatration
BUG:   Added Landmark points back into loading
ENH:   Added test data to suite of FEM tools.  Test data added to FEM toolkit
       for supporting new refactored framework.
COMP:  Fix circular dependency issue btw FEM and SpatialObjects
COMP:  Compile errors
COMP:  Commented out Examples to allow building.  Worked with Brad King to
       fix bugs in the DATA{} upload mechanism
ENH:   Decoupled reading of FEM objects.
BUG:   Fixed failing tests and documentation
STYLE: Removed unnecessary files from build tree.
COMP: Rebased to current ITK, to pick up new MetaIO for FEM
COMP: cppcheck static analysis

FEM specific code from SpatialObjects was
extracted to the FEM module, and a generic
registration interface was added to Spatial
Object to allow runtime additions of
supported objects that conform to the
SpatialObject interface.

Change-Id: I777c0aeb201762292aeecad113258442da23033e
  • Loading branch information
Kent Williams authored and hjmjohnson committed Jul 15, 2011
1 parent 764b2e3 commit 23f10a9
Show file tree
Hide file tree
Showing 250 changed files with 21,903 additions and 12,765 deletions.
13 changes: 8 additions & 5 deletions Examples/Registration/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,14 @@ target_link_libraries(MultiResImageRegistration2 ${ITK_LIBRARIES})
add_executable(MultiResImageRegistration3 MultiResImageRegistration3.cxx )
target_link_libraries(MultiResImageRegistration3 ${ITK_LIBRARIES})

add_executable(DeformableRegistration1 DeformableRegistration1.cxx )
target_link_libraries(DeformableRegistration1 ${ITK_LIBRARIES})
## VAM FIXME HACK DeformableRegistration1 and DeformableRegistration11
# both depend on FEM framework, and need to be updated to
# accomodate the api
#add_executable(DeformableRegistration1 DeformableRegistration1.cxx )
#target_link_libraries(DeformableRegistration1 ${ITK_LIBRARIES})
#
#add_executable(DeformableRegistration11 DeformableRegistration11.cxx )
#target_link_libraries(DeformableRegistration11 ${ITK_LIBRARIES})

add_executable(DeformableRegistration2 DeformableRegistration2.cxx )
target_link_libraries(DeformableRegistration2 ${ITK_LIBRARIES})
Expand All @@ -97,9 +103,6 @@ target_link_libraries(DeformableRegistration3 ${ITK_LIBRARIES})
add_executable(DeformableRegistration5 DeformableRegistration5.cxx )
target_link_libraries(DeformableRegistration5 ${ITK_LIBRARIES})

add_executable(DeformableRegistration11 DeformableRegistration11.cxx )
target_link_libraries(DeformableRegistration11 ${ITK_LIBRARIES})

add_executable(DeformableRegistration12 DeformableRegistration12.cxx )
target_link_libraries(DeformableRegistration12 ${ITK_LIBRARIES})

Expand Down
18 changes: 4 additions & 14 deletions Examples/Registration/DeformableRegistration1.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@
* limitations under the License.
*
*=========================================================================*/
#if defined(_MSC_VER)
#pragma warning ( disable : 4786 )
#endif


#include "itkImageFileReader.h"
#include "itkImageFileWriter.h"
Expand All @@ -39,7 +35,6 @@


// Software Guide : BeginCodeSnippet
#include "itkFEM.h"
#include "itkFEMRegistrationFilter.h"

// Software Guide : EndCodeSnippet
Expand All @@ -58,7 +53,7 @@


// Software Guide : BeginCodeSnippet
typedef itk::Image<unsigned char, 2> fileImageType;
typedef itk::Image<unsigned char, 2> DiskImageType;
typedef itk::Image<float, 2> ImageType;
typedef itk::fem::Element2DC0LinearQuadrilateralMembrane ElementType;
typedef itk::fem::Element2DC0LinearTriangularMembrane ElementType2;
Expand Down Expand Up @@ -198,8 +193,8 @@ int main(int argc, char *argv[])
}

// Read the image files
typedef itk::ImageFileReader< fileImageType > FileSourceType;
typedef fileImageType::PixelType PixType;
typedef itk::ImageFileReader< DiskImageType > FileSourceType;
typedef DiskImageType::PixelType PixType;

FileSourceType::Pointer movingfilter = FileSourceType::New();
movingfilter->SetFileName( (registrationFilter->GetMovingFile()).c_str() );
Expand Down Expand Up @@ -232,7 +227,7 @@ int main(int argc, char *argv[])


// Rescale the image intensities so that they fall between 0 and 255
typedef itk::RescaleIntensityImageFilter<fileImageType,ImageType> FilterType;
typedef itk::RescaleIntensityImageFilter<DiskImageType,ImageType> FilterType;
FilterType::Pointer movingrescalefilter = FilterType::New();
FilterType::Pointer fixedrescalefilter = FilterType::New();

Expand Down Expand Up @@ -297,9 +292,6 @@ int main(int argc, char *argv[])
return EXIT_FAILURE;
}




// Software Guide : BeginLatex
//
// In order to initialize the mesh of elements, we must first create
Expand Down Expand Up @@ -388,5 +380,3 @@ int main(int argc, char *argv[])

return EXIT_SUCCESS;
}


17 changes: 2 additions & 15 deletions Examples/Registration/DeformableRegistration11.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,9 @@
#include "itkRescaleIntensityImageFilter.h"
#include "itkHistogramMatchingImageFilter.h"

#include "itkFEM.h"
#include "itkFEMRegistrationFilter.h"



/* Example of FEM-base deformable registration in 3D */


Expand Down Expand Up @@ -60,9 +58,6 @@ typedef itk::fem::VisitorDispatcher<ElementType,ElementLoadType, LoadImpFP>
typedef itk::fem::VisitorDispatcher<ElementType2,ElementLoadType2, LoadImpFP2>
DispatcherType2;




typedef itk::fem::FEMRegistrationFilter<ImageType,ImageType> RegistrationType;


Expand All @@ -81,7 +76,6 @@ int main(int argc, char *argv[])
}



// Register the correct load implementation with the element-typed visitor
// dispatcher.
typedef itk::fem::ImageMetricLoadImplementation<
Expand All @@ -98,12 +92,8 @@ int main(int argc, char *argv[])
}



RegistrationType::Pointer registrationFilter = RegistrationType::New();




// Attempt to read the parameter file, and exit if an error occurs
registrationFilter->SetConfigFileName(paramname);
if ( !registrationFilter->ReadConfigFile(
Expand All @@ -113,8 +103,8 @@ int main(int argc, char *argv[])
}

// Read the image files
typedef itk::ImageFileReader< FileImageType > FileSourceType;
typedef FileImageType::PixelType PixType;
typedef itk::ImageFileReader< FileImageType > FileSourceType;
typedef FileImageType::PixelType PixType;

FileSourceType::Pointer movingfilter = FileSourceType::New();
movingfilter->SetFileName( (registrationFilter->GetMovingFile()).c_str() );
Expand Down Expand Up @@ -199,7 +189,6 @@ int main(int argc, char *argv[])
writer2->Write();



// Create the material properties
itk::fem::MaterialLinearElasticity::Pointer m;
m = itk::fem::MaterialLinearElasticity::New();
Expand Down Expand Up @@ -237,5 +226,3 @@ int main(int argc, char *argv[])

return EXIT_SUCCESS;
}


1 change: 1 addition & 0 deletions Modules/Core/Mesh/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ itkMeshSpatialObjectIOTest.cxx
itkTriangleMeshToSimplexMeshFilter2Test.cxx
)

set(ITK-Mesh-Test_LIBRARIES ITK-SpatialObjects)
CreateTestDriver(ITK-Mesh "${ITK-Mesh-Test_LIBRARIES}" "${ITK-MeshTests}")

itk_add_test(NAME itkMeshHeaderTest
Expand Down
3 changes: 1 addition & 2 deletions Modules/Core/SpatialObjects/include/itkSceneSpatialObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ class ITK_EXPORT SceneSpatialObject:
typedef SpatialObject< TSpaceDimension > SpatialObjectType;
typedef typename SpatialObjectType::Pointer SpatialObjectPointer;

typedef std::list< SpatialObjectPointer >
ObjectListType;
typedef std::list< SpatialObjectPointer > ObjectListType;

itkStaticConstMacro(MaximumDepth, unsigned int, 9999999);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
#include <iostream>
#include "itkFEMLoadImplementationGenericLandmarkLoad.h"
#include "itkFEMElement2DC0LinearQuadrilateralMembrane.h"
#include "itkFEM.h"
#include "itkFEMLinearSystemWrapperItpack.h"


//
Expand Down Expand Up @@ -123,5 +121,3 @@ int itkFEMLandmarkLoadImplementationTest(int, char*[])
std::cout << "Test PASSED!\n";
return EXIT_SUCCESS;
}


Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#include "itkDeformableMesh3DFilter.h"
#include "itkDemonsRegistrationFilter.h"
#include "itkExtensionVelocitiesImageFilter.h"
#include "itkFEMRegistrationFilter.h"
//#include "itkFEMRegistrationFilter.h"
#include "itkFastMarchingImageFilter.h"

int main (int , char* [])
Expand Down Expand Up @@ -107,9 +107,9 @@ int main (int , char* [])
itk::ExtensionVelocitiesImageFilter<InputType,float,1>::New();
std:: cout << "-------------ExtensionVelocitiesImageFilter " << ExtensionVelocitiesImageFilterObj;

itk::fem::FEMRegistrationFilter<InputType,InputType>::Pointer FEMRegistrationFilterObj =
itk::fem::FEMRegistrationFilter<InputType,InputType>::New();
std:: cout << "-------------FEMRegistrationFilter " << FEMRegistrationFilterObj;
// itk::fem::FEMRegistrationFilter<InputType,InputType>::Pointer FEMRegistrationFilterObj =
// itk::fem::FEMRegistrationFilter<InputType,InputType>::New();
// std:: cout << "-------------FEMRegistrationFilter " << FEMRegistrationFilterObj;

itk::FastMarchingExtensionImageFilter<InputType,float>::Pointer FastMarchingExtensionImageFilterObj =
itk::FastMarchingExtensionImageFilter<InputType,float>::New();
Expand Down
3 changes: 2 additions & 1 deletion Modules/Numerics/FEM/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
project(ITK-FEM)

set(ITK-FEM_LIBRARIES ITK-FEM)
itk_module_impl()
itk_module_impl()
12 changes: 0 additions & 12 deletions Modules/Numerics/FEM/ReadMe.txt

This file was deleted.

30 changes: 0 additions & 30 deletions Modules/Numerics/FEM/ToDo.txt

This file was deleted.

50 changes: 0 additions & 50 deletions Modules/Numerics/FEM/include/itkFEM.h

This file was deleted.

Loading

0 comments on commit 23f10a9

Please sign in to comment.