Skip to content

Commit

Permalink
Merge pull request #101 from Florent2305/fusion
Browse files Browse the repository at this point in the history
Fusion of private and public  Anima
  • Loading branch information
Florent2305 authored Oct 4, 2023
2 parents 0f2605c + 43f4f7d commit 6197004
Show file tree
Hide file tree
Showing 181 changed files with 19,153 additions and 78 deletions.
15 changes: 15 additions & 0 deletions Anima/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Set the default behavior, in case people don't have core.autocrlf set.
* text=auto

# Explicitly declare text files you want to always be normalized and converted
# to native line endings on checkout.
*.c text eol=lf
*.h text eol=lf
*.cxx text eol=lf
*.hxx text eol=lf
*.cpp text eol=lf
*.txt text eol=lf

# Denote all files that are truly binary and should not be modified.
*.png binary
*.jpg binary
10 changes: 10 additions & 0 deletions Anima/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
*~
*.swp
*.user
*.orig
*.directory
*.DS_Store
*.aps
*.autosave
CMakeLists.txt.user.*
CMakeFiles
6 changes: 6 additions & 0 deletions Anima/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
ANIMA: Source Code Repository
-----

ANIMA has been created as the new place to hold the softwares from Empenn. Mainly based on ITK and VTK, it has been designed to hold C++ source code in a modular structure. People in the team are encouraged to contribute their algorithms here so that others may benefit from it easily.

Refer to the [wiki](https://github.com/Inria-Visages/Anima/wiki) for more information
5 changes: 3 additions & 2 deletions Anima/diffusion/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ project(ANIMA-DIFFUSION)
# Here go the add_subdirectories, no code should be at the root of the project
################################################################################

add_subdirectory(dti_estimator)
add_subdirectory(dti_tools)
add_subdirectory(dti)
add_subdirectory(mcm)
add_subdirectory(mcm_estimator)
add_subdirectory(mcm_estimator/low_memory)
add_subdirectory(mcm_model_averaging)
add_subdirectory(mcm_tools)

if(USE_VTK AND VTK_FOUND)
Expand Down
6 changes: 6 additions & 0 deletions Anima/diffusion/dti/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
add_subdirectory(dti_estimator)
add_subdirectory(dti_scalar_maps)
add_subdirectory(dwi_simulator_from_dti)
add_subdirectory(flip_tensors)
add_subdirectory(background_noise_variance_estimator)
add_subdirectory(dti_non_central_chi_estimator)
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
if(BUILD_TOOLS)

project(animaBackgroundNoiseVarianceEstimator)

## #############################################################################
## List Sources
## #############################################################################

list_source_files(${PROJECT_NAME}
${CMAKE_CURRENT_SOURCE_DIR}
)


## #############################################################################
## add executable
## #############################################################################

add_executable(${PROJECT_NAME}
${${PROJECT_NAME}_CFILES}
)


## #############################################################################
## Link
## #############################################################################

target_link_libraries(${PROJECT_NAME}
${ITKIO_LIBRARIES}
AnimaStatisticalTests
)

## #############################################################################
## install
## #############################################################################

set_exe_install_rules(${PROJECT_NAME})

endif()
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
#pragma once

#include <iostream>
#include <animaNumberedThreadImageToImageFilter.h>
#include <itkVectorImage.h>
#include <itkImage.h>
#include <vnl/vnl_matrix.h>
#include <vector>

namespace anima
{
template <typename TInputImage>
class BackgroundNoiseVarianceEstimationImageFilter :
public anima::NumberedThreadImageToImageFilter < TInputImage, itk::Image<unsigned char,3> >
{
public:
/** Standard class typedefs. */
typedef BackgroundNoiseVarianceEstimationImageFilter Self;
typedef itk::Image<unsigned char,3> TOutputImage;
typedef itk::VectorImage <double,3> VectorImageType;
typedef VectorImageType::Pointer VectorImagePointer;

typedef anima::NumberedThreadImageToImageFilter <TInputImage, TOutputImage> Superclass;
typedef itk::SmartPointer<Self> Pointer;
typedef itk::SmartPointer<const Self> ConstPointer;

/** Method for creation through the object factory. */
itkNewMacro(Self)

/** Run-time type information (and related methods) */
itkTypeMacro(BackgroundNoiseVarianceEstimationImageFilter, anima::NumberedThreadImageToImageFilter)

typedef typename TOutputImage::PixelType OutputPixelType;
typedef typename TInputImage::PixelType InputPixelType;

/** Image typedef support */
typedef TInputImage InputImageType;
typedef TOutputImage OutputImageType;
typedef typename InputImageType::Pointer InputImagePointer;
typedef typename InputImageType::IndexType InputImageIndexType;
typedef typename InputImageType::PixelType InputImagePixelType;
typedef typename OutputImageType::Pointer OutputImagePointer;

/** Superclass typedefs. */
typedef typename Superclass::InputImageRegionType InputImageRegionType;
typedef typename Superclass::OutputImageRegionType OutputImageRegionType;

//! Actually computes partial variances for this region
void ComputePartialVariance(const OutputImageRegionType &region);

//! Actually updates output for this region
void PartialUpdateOutput(const OutputImageRegionType &region);

itkSetMacro(PValueThreshold, double)
itkGetMacro(OutputVariance, double)

itkSetMacro(NumberOfCoils, unsigned int)

void SetTheoreticalSnr(std::vector <double> theoreticalSnr ){m_TheoreticalSnr = theoreticalSnr;}
void SetBValuesList(std::vector <double> bValuesList ){m_BValuesList = bValuesList;}

itkSetMacro(QuantileInitialization, double)

itkSetMacro(EstimatedB0Image, InputImagePointer)
itkSetMacro(DTIImage, VectorImagePointer)

void AddGradientDirection(unsigned int i, std::vector <double> &grad);

protected:
BackgroundNoiseVarianceEstimationImageFilter()
: Superclass()
{
m_NumberOfCoils = 1;
m_PValueThreshold = 0.05;
m_OutputVariance = 0;
m_SlopeInterceptDesignPart = 0;
m_QuantileInitialization = 0.5;

m_EstimatedB0Image = NULL;
m_DTIImage = NULL;
}

virtual ~BackgroundNoiseVarianceEstimationImageFilter() {}

//Redefine virtual functions
void GenerateData() ITK_OVERRIDE;

unsigned int ComputeInitialOutputFromDTI();
unsigned int UpdateOutputFromPValues();

private:
ITK_DISALLOW_COPY_AND_ASSIGN(BackgroundNoiseVarianceEstimationImageFilter);

std::vector <double> m_PartialVariances;
std::vector <unsigned int> m_PartialNumberOfCoils;

itk::Image<double,3>::Pointer m_WorkPValImage;
InputImagePointer m_EstimatedB0Image;
VectorImagePointer m_DTIImage;

std::vector <double> m_BValuesList;
std::vector< std::vector <double> > m_GradientDirections;
vnl_matrix <double> m_DesignMatrix;
double m_SlopeInterceptDesignPart;
double m_QuantileInitialization;

double m_OutputVariance;
unsigned int m_TotalNumberOfCoils;
unsigned int m_NumPixels;
unsigned int m_NumberOfCoils;
std::vector <double> m_TheoreticalSnr;
double m_PValueThreshold;

static const unsigned int m_NumberOfComponents = 6;
};

} // end of namespace anima

#include "animaBackgroundNoiseVarianceEstimationImageFilter.hxx"
Loading

0 comments on commit 6197004

Please sign in to comment.