23 #include <itkImageFileReader.h>
24 #include <itkExceptionObject.h>
25 #include <itkImageFileWriter.h>
26 #include <itkMetaDataObject.h>
27 #include <itkVectorImage.h>
28 #include <itkResampleImageFilter.h>
35 #include <boost/lexical_cast.hpp>
50 int main(
int argc,
char* argv[])
54 parser.
setTitle(
"Multishell Methods");
55 parser.
setCategory(
"Fiber Tracking and Processing Methods");
67 map<string, us::Any> parsedArgs = parser.
parseArguments(argc, argv);
68 if (parsedArgs.size()==0)
73 string outName =
us::any_cast<
string>(parsedArgs[
"out"]);
76 bool applyBiExp =
us::any_cast<
bool>(parsedArgs[
"biexp"]);
77 string targetType =
us::any_cast<
string>(parsedArgs[
"targetbvalue"]);
81 std::cout <<
"Loading " << inName;
92 roundfilter->SetRoundingValue( 1000 );
95 roundfilter->Update();
116 vnl_vector<double> bValueList(originalShellMap.size()-1);
117 double targetBValue = bValueList.mean();
119 mitk::DiffusionPropertyHelper::BValueMapType::const_iterator it = originalShellMap.begin();
121 for(; it != originalShellMap.end(); ++it)
122 bValueList.put(i++,it->first);
124 if( targetType ==
"mean" )
125 targetBValue = bValueList.mean();
126 else if( targetType ==
"min" )
127 targetBValue = bValueList.min_value();
128 else if( targetType ==
"max" )
129 targetBValue = bValueList.max_value();
134 filter->SetInput(vectorImage);
135 filter->SetOriginalGradientDirections(gradientContainer);
136 filter->SetOriginalBValueMap(originalShellMap);
137 filter->SetOriginalBValue(bValue);
140 functor->setListOfBValues(bValueList);
141 functor->setTargetBValue(targetBValue);
143 filter->SetFunctor(functor);
157 filter->SetInput(vectorImage);
158 filter->SetOriginalGradientDirections(gradientContainer);
159 filter->SetOriginalBValueMap(originalShellMap);
160 filter->SetOriginalBValue(bValue);
163 functor->setListOfBValues(bValueList);
164 functor->setTargetBValue(targetBValue);
166 filter->SetFunctor(functor);
180 filter->SetInput(vectorImage);
181 filter->SetOriginalGradientDirections(gradientContainer);
182 filter->SetOriginalBValueMap(originalShellMap);
183 filter->SetOriginalBValue(bValue);
186 functor->setListOfBValues(bValueList);
187 functor->setTargetBValue(targetBValue);
189 filter->SetFunctor(functor);
202 catch (itk::ExceptionObject e)
207 catch (std::exception e)
209 std::cout << e.what();
214 std::cout <<
"ERROR!?!";
bool IsDiffusionWeightedImage() const
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
void setContributor(std::string contributor)
Helper class for mitk::Images containing diffusion weighted data.
ValueType * any_cast(Any *operand)
mitk::BValueMapProperty::BValueMap BValueMapType
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.
const BValueMapType & GetBValueMap() const
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)
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
static const std::string GRADIENTCONTAINERPROPERTYNAME
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[])
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.