16 #ifndef mitkCLPolyToNrrd_cpp
17 #define mitkCLPolyToNrrd_cpp
26 #include "itkImageRegionIterator.h"
32 #include <itkLabelStatisticsImageFilter.h>
33 #include <itkMinimumMaximumImageCalculator.h>
38 template<
typename TPixel,
unsigned int VImageDimension>
42 typedef itk::Image<TPixel, VImageDimension>
ImageType;
43 typedef itk::Image<unsigned char, VImageDimension> MaskType;
50 itk::ImageRegionIterator<ImageType> iterI1(itkImage, itkImage->GetLargestPossibleRegion());
51 itk::ImageRegionIterator<ImageType> iterI2(itkIm2, itkImage->GetLargestPossibleRegion());
52 itk::ImageRegionIterator<MaskType> iter(itkMask1, itkImage->GetLargestPossibleRegion());
53 while (! iter.IsAtEnd())
55 unsigned char maskV = 0;
56 if (iterI1.Value() > 0.0001 && iterI2.Value() > 0.00001)
68 int main(
int argc,
char* argv[])
80 parser.
setTitle(
"MR Normalization Tool");
81 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.");
84 std::map<std::string, us::Any> parsedArgs = parser.
parseArguments(argc, argv);
86 if (parsedArgs.size()==0)
90 if ( parsedArgs.count(
"help") || parsedArgs.count(
"h"))
#define AccessByItk_3(mitkImage, itkImageTypeFunction, arg1, arg2, arg3)
itk::SmartPointer< Self > Pointer
itk::Image< unsigned char, 3 > ImageType
void setContributor(std::string contributor)
itk::Image< double, 3 > FloatImageType
int main(int argc, char *argv[])
std::map< std::string, us::Any > parseArguments(const StringContainerType &arguments, bool *ok=nullptr)
Image::Pointer ImportItkImage(const itk::SmartPointer< ItkOutputImageType > &itkimage, const BaseGeometry *geometry=nullptr, bool update=true)
Imports an itk::Image (with a specific type) as an mitk::Image.Instantiates instance of ITKImageImpor...
static bool SaveImage(mitk::Image::Pointer image, const std::string &path)
SaveImage Convenience method to save an arbitrary mitkImage.
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)
itk::Image< unsigned char, 3 > MaskImageType
void setCategory(std::string category)
void setArgumentPrefix(const std::string &longPrefix, const std::string &shortPrefix)
void Normalize(itk::Image< TPixel, VImageDimension > *itkImage, mitk::Image::Pointer im2, mitk::Image::Pointer mask1, std::string output)
void MITKCORE_EXPORT CastToItkImage(const mitk::Image *mitkImage, itk::SmartPointer< ItkOutputImageType > &itkOutputImage)
Cast an mitk::Image to an itk::Image with a specific type.
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.
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.