20 #include <metaCommand.h>
23 #include <itkImageFileWriter.h>
24 #include <itkImageFileReader.h>
26 #include <boost/lexical_cast.hpp>
28 #include <itkFlipImageFilter.h>
32 #define _USE_MATH_DEFINES
47 parser.
setDescription(
"Convert MITK spherical harmonics image type to MRtrix spherical harmonics image");
55 map<string, us::Any> parsedArgs = parser.
parseArguments(argc, argv);
56 if (parsedArgs.size()==0)
59 string inFile =
us::any_cast<
string>(parsedArgs[
"input"]);
60 string outFile =
us::any_cast<
string>(parsedArgs[
"output"]);
65 typedef itk::Image< float, 4 > OutImageType;
69 typedef itk::ImageFileReader< InputImageType > ReaderType;
71 std::cout <<
"reading " << inFile;
72 reader->SetFileName(inFile.c_str());
74 itkInImage = reader->GetOutput();
78 filter->SetInputImage(itkInImage);
79 filter->GenerateData();
85 catch (itk::ExceptionObject e)
90 catch (std::exception e)
92 std::cout << e.what();
97 std::cout <<
"ERROR!?!";
103 int main(
int argc,
char* argv[])
117 map<string, us::Any> parsedArgs = parser.
parseArguments(argc, argv);
118 if (parsedArgs.size()==0)
122 if (parsedArgs.count(
"shOrder"))
123 shOrder = us::any_cast<int>(parsedArgs[
"shOrder"]);
128 return StartShConversion<4>(argc, argv);
130 return StartShConversion<6>(argc, argv);
132 return StartShConversion<8>(argc, argv);
134 return StartShConversion<10>(argc, argv);
136 return StartShConversion<12>(argc, argv);
static void Save(const mitk::BaseData *data, const std::string &path)
Save a mitk::BaseData instance.
itk::SmartPointer< Self > Pointer
void setContributor(std::string contributor)
ValueType * any_cast(Any *operand)
int StartShConversion(int argc, char *argv[])
Convert MITK spherical harmonics image type to MRtrix spherical harmonics image.
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.
itk::Image< double, 3 > InputImageType
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)
int main(int argc, char *argv[])
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 itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.