Skip to content

Commit

Permalink
Version 1.01 User Experience Update:
Browse files Browse the repository at this point in the history
Fixed scalarstats not outputing mesh properly.
Added specular option to overlay app.
Added display of orientation flag in image info.
Added method for image orientation in image class
Added update of scalar range on refresh for scalar operations.
Added DOB and weight to anonymise.
Improved progress updates for anonymise DICOMs.
Tweaked DICOM anonymise wizard.
  • Loading branch information
shakes76 committed Jul 5, 2017
1 parent ddb5e5c commit cf01d5b
Show file tree
Hide file tree
Showing 8 changed files with 195 additions and 88 deletions.
6 changes: 5 additions & 1 deletion apps/milxModelApp/milxModelApp.cxx
Expand Up @@ -113,7 +113,7 @@ int main(int argc, char *argv[])
SwitchArg concatenateArg("", "cat", "Concatenate N surfaces into single mesh with filename provided.", false);
SwitchArg colourConcatenateArg("", "colourcat", "Concatenate N surfaces into single mesh with filename provided and colour them.", false);
SwitchArg splitArg("", "split", "Split each surface given components.", false);
SwitchArg diffScalarArg("", "scalardiff", "Compute the differences in Scalars.", false);
SwitchArg diffScalarArg("", "scalardiff", "Compute the differences in Scalars to the first mesh in list.", false);
SwitchArg statsScalarArg("", "scalarstats", "Compute statistics of scalars (mean, variance etc. per point) output mesh with stats as arrays.", false);
SwitchArg removeScalarArg("", "scalarremove", "Remove the scalars.", false);
SwitchArg copyScalarArg("", "scalarcopy", "Copy the Scalars from first mesh to all others while removing existing ones.", false);
Expand Down Expand Up @@ -591,6 +591,8 @@ int main(int argc, char *argv[])

case diffscalars:
Model.ScalarDifferenceCollection(collection);
outputRequired = true;
multiOutputRequired = false;
break;

case diffscalarspairs:
Expand All @@ -603,6 +605,8 @@ int main(int argc, char *argv[])

case statscalars:
Model.ScalarStatisticsCollection(collection);
outputRequired = true;
multiOutputRequired = false;
break;

case removescalars:
Expand Down
4 changes: 4 additions & 0 deletions apps/milxOverlay/milxOverlay.cpp
Expand Up @@ -117,6 +117,7 @@ int main(int argc, char* argv[])
SwitchArg wireframeArg("", "wireframe", "Display initial surface as a wireframe model.", false);
SwitchArg wireframesArg("", "wireframes", "Display all surfaces as a wireframe models.", false);
SwitchArg humanArg("", "nohuman", "Disable human orientation glyph.", false);
SwitchArg specularArg("", "nospecular", "Disable specular lighting for the rendered view.", false);

///Mandatory
UnlabeledMultiArg<std::string> multinames("surfaces", "Surfaces to overlay", true, "Surfaces");
Expand Down Expand Up @@ -184,6 +185,7 @@ int main(int argc, char* argv[])
cmd.add( wireframeArg );
cmd.add( wireframesArg );
cmd.add( humanArg );
cmd.add( specularArg );

///Parse the argv array.
cmd.parse( argc, argv );
Expand Down Expand Up @@ -610,6 +612,8 @@ int main(int argc, char* argv[])
model->loadView();
if(loadViewFileArg.isSet())
model->loadView(loadViewName.c_str());
if(specularArg.isSet())
model->disableSpecularDisplay();
//Zoom
if(zoomArg.isSet())
{
Expand Down
4 changes: 2 additions & 2 deletions include/milxFile.h
Expand Up @@ -990,7 +990,7 @@ itk::SmartPointer<TImage> File::ReadImageUsingITK(const std::string filename)
typedef itk::ImageFileReader<TImage, itk::DefaultConvertPixelTraits<typename TImage::InternalPixelType> > ImageReader; //InternalPixelType != PixelType for vector images
typename ImageReader::Pointer reader = ImageReader::New();
reader->SetFileName(filename.c_str());
reader->AddObserver(itk::ProgressEvent(), ProgressUpdates);
reader->AddObserver(itk::ProgressEvent(), milx::ProgressUpdates);
try
{
reader->Update();
Expand All @@ -1012,7 +1012,7 @@ bool File::WriteImageUsingITK(const std::string filename, itk::SmartPointer<TIma
typename ImageWriter::Pointer writer = ImageWriter::New();
writer->SetFileName(filename.c_str());
writer->SetInput(data);
writer->AddObserver(itk::ProgressEvent(), ProgressUpdates);
writer->AddObserver(itk::ProgressEvent(), milx::ProgressUpdates);
try
{
writer->Update();
Expand Down
68 changes: 68 additions & 0 deletions include/milxImage.h
Expand Up @@ -21,6 +21,7 @@
//ITK
#include <itkVectorImage.h>
#include <itkImageDuplicator.h>
#include <itkSpatialOrientationAdapter.h>
#include <itkRescaleIntensityImageFilter.h>
#include <itkAdaptiveHistogramEqualizationImageFilter.h>
#if (ITK_REVIEW || ITK_VERSION_MAJOR > 3) //Review only members
Expand Down Expand Up @@ -439,6 +440,11 @@ class SMILI_EXPORT Image : public ImageBase
\brief Returns the minimum pixel value of an image.
*/
static double ImageMinimum(itk::SmartPointer<TImage> img);
/*!
\fn Image::ImageOrientation(itk::SmartPointer<TImage> img)
\brief Returns the orientation flag of an image.
*/
static std::string ImageOrientation(itk::SmartPointer<TImage> img);

//Filters
/*!
Expand Down Expand Up @@ -2089,6 +2095,7 @@ void Image<TImage>::Information(itk::SmartPointer<TImage> img)
}
std::cout << " |" << std::endl;
}
std::cout << "\nOrientation Flag: " << ImageOrientation(img) << std::endl;
}

template<class TImage>
Expand All @@ -2115,6 +2122,67 @@ double Image<TImage>::ImageMinimum(itk::SmartPointer<TImage> img)
return imageCalculatorFilter->GetMinimum();
}

template<class TImage>
std::string Image<TImage>::ImageOrientation(itk::SmartPointer<TImage> img)
{
std::map<itk::SpatialOrientation::ValidCoordinateOrientationFlags, std::string> codeToString;

codeToString[itk::SpatialOrientation::ITK_COORDINATE_ORIENTATION_AIL] = "AIL";
codeToString[itk::SpatialOrientation::ITK_COORDINATE_ORIENTATION_ASL] = "ASL";
codeToString[itk::SpatialOrientation::ITK_COORDINATE_ORIENTATION_RAI] = "RAI";
codeToString[itk::SpatialOrientation::ITK_COORDINATE_ORIENTATION_LAI] = "LAI";
codeToString[itk::SpatialOrientation::ITK_COORDINATE_ORIENTATION_RPS] = "RPS";
codeToString[itk::SpatialOrientation::ITK_COORDINATE_ORIENTATION_LPS] = "LPS";
codeToString[itk::SpatialOrientation::ITK_COORDINATE_ORIENTATION_RIP] = "RIP";
codeToString[itk::SpatialOrientation::ITK_COORDINATE_ORIENTATION_LIP] = "LIP";
codeToString[itk::SpatialOrientation::ITK_COORDINATE_ORIENTATION_RSP] = "RSP";
codeToString[itk::SpatialOrientation::ITK_COORDINATE_ORIENTATION_LSP] = "LSP";
codeToString[itk::SpatialOrientation::ITK_COORDINATE_ORIENTATION_RIA] = "RIA";
codeToString[itk::SpatialOrientation::ITK_COORDINATE_ORIENTATION_LIA] = "LIA";
codeToString[itk::SpatialOrientation::ITK_COORDINATE_ORIENTATION_RSA] = "RSA";
codeToString[itk::SpatialOrientation::ITK_COORDINATE_ORIENTATION_LSA] = "LSA";
codeToString[itk::SpatialOrientation::ITK_COORDINATE_ORIENTATION_IRP] = "IRP";
codeToString[itk::SpatialOrientation::ITK_COORDINATE_ORIENTATION_ILP] = "ILP";
codeToString[itk::SpatialOrientation::ITK_COORDINATE_ORIENTATION_SRP] = "SRP";
codeToString[itk::SpatialOrientation::ITK_COORDINATE_ORIENTATION_SLP] = "SLP";
codeToString[itk::SpatialOrientation::ITK_COORDINATE_ORIENTATION_IRA] = "IRA";
codeToString[itk::SpatialOrientation::ITK_COORDINATE_ORIENTATION_ILA] = "ILA";
codeToString[itk::SpatialOrientation::ITK_COORDINATE_ORIENTATION_SRA] = "SRA";
codeToString[itk::SpatialOrientation::ITK_COORDINATE_ORIENTATION_SLA] = "SLA";
codeToString[itk::SpatialOrientation::ITK_COORDINATE_ORIENTATION_RPI] = "RPI";
codeToString[itk::SpatialOrientation::ITK_COORDINATE_ORIENTATION_LPI] = "LPI";
codeToString[itk::SpatialOrientation::ITK_COORDINATE_ORIENTATION_RAS] = "RAS";
codeToString[itk::SpatialOrientation::ITK_COORDINATE_ORIENTATION_LAS] = "LAS";
codeToString[itk::SpatialOrientation::ITK_COORDINATE_ORIENTATION_PRI] = "PRI";
codeToString[itk::SpatialOrientation::ITK_COORDINATE_ORIENTATION_PLI] = "PLI";
codeToString[itk::SpatialOrientation::ITK_COORDINATE_ORIENTATION_ARI] = "ARI";
codeToString[itk::SpatialOrientation::ITK_COORDINATE_ORIENTATION_ALI] = "ALI";
codeToString[itk::SpatialOrientation::ITK_COORDINATE_ORIENTATION_PRS] = "PRS";
codeToString[itk::SpatialOrientation::ITK_COORDINATE_ORIENTATION_PLS] = "PLS";
codeToString[itk::SpatialOrientation::ITK_COORDINATE_ORIENTATION_ARS] = "ARS";
codeToString[itk::SpatialOrientation::ITK_COORDINATE_ORIENTATION_ALS] = "ALS";
codeToString[itk::SpatialOrientation::ITK_COORDINATE_ORIENTATION_IPR] = "IPR";
codeToString[itk::SpatialOrientation::ITK_COORDINATE_ORIENTATION_SPR] = "SPR";
codeToString[itk::SpatialOrientation::ITK_COORDINATE_ORIENTATION_IAR] = "IAR";
codeToString[itk::SpatialOrientation::ITK_COORDINATE_ORIENTATION_SAR] = "SAR";
codeToString[itk::SpatialOrientation::ITK_COORDINATE_ORIENTATION_IPL] = "IPL";
codeToString[itk::SpatialOrientation::ITK_COORDINATE_ORIENTATION_SPL] = "SPL";
codeToString[itk::SpatialOrientation::ITK_COORDINATE_ORIENTATION_IAL] = "IAL";
codeToString[itk::SpatialOrientation::ITK_COORDINATE_ORIENTATION_SAL] = "SAL";
codeToString[itk::SpatialOrientation::ITK_COORDINATE_ORIENTATION_PIR] = "PIR";
codeToString[itk::SpatialOrientation::ITK_COORDINATE_ORIENTATION_PSR] = "PSR";
codeToString[itk::SpatialOrientation::ITK_COORDINATE_ORIENTATION_AIR] = "AIR";
codeToString[itk::SpatialOrientation::ITK_COORDINATE_ORIENTATION_ASR] = "ASR";
codeToString[itk::SpatialOrientation::ITK_COORDINATE_ORIENTATION_PIL] = "PIL";
codeToString[itk::SpatialOrientation::ITK_COORDINATE_ORIENTATION_PSL] = "PSL";
codeToString[itk::SpatialOrientation::ITK_COORDINATE_ORIENTATION_INVALID] = "Unknown";

itk::SpatialOrientation::ValidCoordinateOrientationFlags orientFlag = itk::SpatialOrientationAdapter().FromDirectionCosines(img->GetDirection());
std::string orientFlagStr = codeToString[orientFlag];

return orientFlagStr;
}

//Filters
template<class TImage>
itk::SmartPointer<TImage> Image<TImage>::CheckerBoard(itk::SmartPointer<TImage> img, itk::SmartPointer<TImage> imgToCheckerBoard, const int numberOfSquares)
Expand Down

0 comments on commit cf01d5b

Please sign in to comment.