19 #include <boost/algorithm/string.hpp>
37 int main(
int argc,
char* argv[])
44 parser.
setDescription(
"Denoising for diffusion weighted images using a non-local means algorithm.");
60 map<string, us::Any> parsedArgs = parser.
parseArguments(argc, argv);
61 if (parsedArgs.size()==0)
64 string inFileName =
us::any_cast<
string>(parsedArgs[
"input"]);
65 double variance =
static_cast<double>(
us::any_cast<
float>(parsedArgs[
"variance"]));
67 if (parsedArgs.count(
"mask"))
68 maskName = us::any_cast<string>(parsedArgs[
"mask"]);
69 string outFileName =
us::any_cast<
string>(parsedArgs[
"output"]);
72 if (parsedArgs.count(
"search"))
73 search = us::any_cast<int>(parsedArgs[
"search"]);
75 if (parsedArgs.count(
"compare"))
76 compare = us::any_cast<int>(parsedArgs[
"compare"]);
78 if (parsedArgs.count(
"joint"))
81 if (parsedArgs.count(
"rician"))
87 if( boost::algorithm::ends_with(inFileName,
".dwi"))
96 filter->SetNumberOfThreads(12);
97 filter->SetInputImage( itkVectorImagePointer );
99 if (!maskName.empty())
104 filter->SetInputMask(itkMask);
107 filter->SetUseJointInformation(joint);
108 filter->SetUseRicianAdaption(rician);
109 filter->SetSearchRadius(search);
110 filter->SetComparisonRadius(compare);
111 filter->SetVariance(variance);
127 std::cout <<
"Only supported for .dwi!";
130 catch (itk::ExceptionObject e)
135 catch (std::exception e)
137 std::cout << e.what();
142 std::cout <<
"ERROR!?!";
static void Save(const mitk::BaseData *data, const std::string &path)
Save a mitk::BaseData instance.
static const std::string REFERENCEBVALUEPROPERTYNAME
itk::SmartPointer< Self > Pointer
int main(int argc, char *argv[])
void changeParameterGroup(std::string name, std::string tooltip)
void setContributor(std::string contributor)
Helper class for mitk::Images containing diffusion weighted data.
ValueType * any_cast(Any *operand)
std::map< std::string, us::Any > parseArguments(const StringContainerType &arguments, bool *ok=nullptr)
Image::Pointer GrabItkImageMemory(itk::SmartPointer< ItkOutputImageType > &itkimage, mitk::Image *mitkImage=nullptr, const BaseGeometry *geometry=nullptr, bool update=true)
Grabs the memory of an itk::Image (with a specific type) and puts it into an mitk::Image.The memory is managed by the mitk::Image after calling this function. The itk::Image remains valid until the mitk::Image decides to free the memory.
void InitializeImage()
Make certain the owned image is up to date with all necessary properties.
void addArgument(const std::string &longarg, const std::string &shortarg, Type type, const std::string &argLabel, const std::string &argHelp=std::string(), const us::Any &defaultValue=us::Any(), bool optional=true, bool ignoreRest=false, bool deprecated=false)
bool compare(std::pair< double, int > i, std::pair< double, int > j)
Image class for storing images.
void setCategory(std::string category)
void setArgumentPrefix(const std::string &longPrefix, const std::string &shortPrefix)
float GetReferenceBValue() const
void MITKCORE_EXPORT CastToItkImage(const mitk::Image *mitkImage, itk::SmartPointer< ItkOutputImageType > &itkOutputImage)
Cast an mitk::Image to an itk::Image with a specific type.
GradientDirectionsContainerType::Pointer GetGradientContainer() const
mitk::Image DiffusionImageType
static const std::string GRADIENTCONTAINERPROPERTYNAME
void setTitle(std::string title)
itk::Image< short, 3 > ImageType
void setDescription(std::string description)
static mitk::Image::Pointer LoadImage(const std::string &path)
LoadImage Convenience method to load an arbitrary mitkImage.
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.