SMILI Assistant

milxSMILI


The milxSMILI sub-library is a user interface independent library that directly interfaces with ITK and VTK libraries. It has three main classes that encapsulate most of its functionality. These are the milxImage, milxModel and milxFile objects. Each of the image and model classes have collection members to allow iteration through a number of images or models easily with a single function call. Since it is a library that essentially wraps ITK and VTK, its coding style matches these libraries via KWStyle.

milxImage

This class is built to interact with ITK only (with vtkImageData interaction if VTK is available) and is a simple templated interface to complete a number of frequently encountered tasks in image processing. It has been templated as ITK is templated and designed in a similar manner, allowing it to be utilised directly by replacing chunks of ITK code or strung together in a pipeline. Example usages include:
  ///Compute distance map of a VTK image data
vtkSmartPointer<vtkImageData> imgData = GetImageDataFromSomeWhere();
LabelImageType::Pointer image = milx::Image<LabelImageType>::ConvertVTKImageToITKImage(imgData);
FloatImageType::Pointer distanceImage1 = milx::Image<LabelImageType>::DistanceMap<FloatImageType>(image, binary, signedDistance, insideDistance, squaredDistance);
or
  ///Convert a vector to image then write to file
VectorType eigenVector = GetEigenVectorFromSomeWhere();
FloatImageType::Pointer tmpEigenImage = milx::Image<FloatImageType>::ImportVectorToImage<PrecisionType>(eigenVector, m_Images[0]->GetLargestPossibleRegion().GetSize(), m_Images[0]);
FloatImageType::Pointer eigenImage = milx::Image<FloatImageType>::DuplicateImage(tmpEigenImage); //force copy to unlock vnl vector

if(!milx::File::SaveImage<FloatImageType>(formatString + milx::NumberToString(j) + ".nii.gz", eigenImage))
{
std::cout << "ExceptionObject caught while writing one of the model images!" << std::endl;
itk::ExceptionObject exception(__FILE__, __LINE__, "ExceptionObject caught while writing one of the model images!", "GenerateAAMData");
throw exception;
}
This means it is easy to accomplish supported tasks easily and adaptable to your data or image type. The application designed to use this class is the milxImageApp.

milxModel

This class is built to interact with VTK only and specifically encapsulates vtkPolyData and its operations. It maintains its own status through the use of current and previous states to allow easy processing such as:
PreProcessSurface(vtkSmartPointer<vtkPolyData> surface)
{
milx::Model model;

model.SetInput(surface);
model.ClusterDecimate();
model.WindowedSincSmoothing(20); //Preserve features
model.Clean();
model.Update();

return model.GetOutput();
}
The application designed to use this class is the milxModelApp.