16 #ifndef mitkCLPolyToNrrd_cpp
17 #define mitkCLPolyToNrrd_cpp
26 #include "itkImageRegionIterator.h"
35 #include <itkLabelStatisticsImageFilter.h>
36 #include <itkMinimumMaximumImageCalculator.h>
41 int main(
int argc,
char* argv[])
48 parser.
addArgument(
"mode",
"mode",
mitkCommandLineParser::InputImage,
"Normalisation mode",
"1,2,3: Single Area normalization to Mean, Median, Mode, 4,5,6: Mean, Median, Mode of two regions. ",
us::Any(),
false);
55 parser.
setTitle(
"MR Normalization Tool");
56 parser.
setDescription(
"Normalizes a MR image. Sets the Median of the tissue covered by mask 0 to 0 and the median of the area covered by mask 1 to 1.");
59 std::map<std::string, us::Any> parsedArgs = parser.
parseArguments(argc, argv);
61 if (parsedArgs.size()==0)
65 if ( parsedArgs.count(
"help") || parsedArgs.count(
"h"))
86 twoRegion->SetInput(image);
88 twoRegion->SetMask1(mask0);
89 twoRegion->SetMask2(mask1);
96 output=oneRegion->GetOutput();
101 output=oneRegion->GetOutput();
106 output=oneRegion->GetOutput();
112 output=twoRegion->GetOutput();
118 output=twoRegion->GetOutput();
124 output=twoRegion->GetOutput();
void setContributor(std::string contributor)
std::map< std::string, us::Any > parseArguments(const StringContainerType &arguments, bool *ok=nullptr)
static bool SaveImage(mitk::Image::Pointer image, const std::string &path)
SaveImage Convenience method to save an arbitrary mitkImage.
itk::Image< unsigned char, 3 > MaskImageType
itk::Image< double, 3 > FloatImageType
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)
void setCategory(std::string category)
void setArgumentPrefix(const std::string &longPrefix, const std::string &shortPrefix)
void setTitle(std::string title)
void setDescription(std::string description)
static mitk::Image::Pointer LoadImage(const std::string &path)
LoadImage Convenience method to load an arbitrary mitkImage.
int main(int argc, char *argv[])