X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;ds=inline;f=vv%2FvvMaximumIntensityProjection.cxx;h=c7ffb52d0078e1fda50e8f11a528acb23f6c9167;hb=3d059f81bab4d113bdd5e87bc15a266381ee7182;hp=077a884cab2932e48a4070d0439020e733181a73;hpb=1e034c70105f0926939acaaa27ddb46e904ae8bf;p=clitk.git diff --git a/vv/vvMaximumIntensityProjection.cxx b/vv/vvMaximumIntensityProjection.cxx index 077a884..c7ffb52 100644 --- a/vv/vvMaximumIntensityProjection.cxx +++ b/vv/vvMaximumIntensityProjection.cxx @@ -14,7 +14,7 @@ - BSD See included LICENSE.txt file - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html -======================================================================-====*/ + ======================================================================-====*/ #include #include @@ -25,11 +25,15 @@ #include "vvFromITK.h" #include "vvMaximumIntensityProjection.h" #include +#include void vvMaximumIntensityProjection::Compute(vvSlicerManager * slicer_manager) { + mCurrentSlicerManager = slicer_manager; + mDimension = QInputDialog::getInteger(0, "MIP Axis","Choose the axis along which to perform the MIP",0,0,\ + slicer_manager->GetImage()->GetNumberOfDimensions()-1,1); #define TRY_TYPE(TYPE) \ -if (clitk::IsSameType(image->GetScalarTypeAsString())) { this->Update_WithPixelType(image); return; } + if (clitk::IsSameType(image->GetScalarTypeAsITKString())) { this->Update_WithPixelType(image); return; } std::string list = clitk::CreateListOfTypes(); vvImage::Pointer image=slicer_manager->GetSlicer(0)->GetImage(); TRY_TYPE(float); @@ -40,7 +44,8 @@ if (clitk::IsSameType(image->GetScalarTypeAsString())) { this->Update_With TRY_TYPE(unsigned short); TRY_TYPE(char); TRY_TYPE(unsigned char); - QMessageBox::warning(0,"Unsupported image type",QString("Error, I don't know the type")+QString(image->GetScalarTypeAsString().c_str()) +QString("' for the input image.\nKnown types are ") + QString(list.c_str())); + QMessageBox::warning(0,"Unsupported image type", + QString("Error, I don't know the type")+QString(image->GetScalarTypeAsITKString().c_str()) +QString("' for the input image.\nKnown types are ") + QString(list.c_str())); error=true; #undef TRY_TYPE } @@ -68,9 +73,12 @@ void vvMaximumIntensityProjection::Update_WithDimAndPixelType(vvImage::Pointer i typedef itk::Image OutputImageType; typedef itk::MaximumProjectionImageFilter FilterType; typename FilterType::Pointer filter = FilterType::New(); - filter->SetProjectionDimension(Dim-1); + filter->SetProjectionDimension(mDimension); typename ImageType::ConstPointer input = vvImageToITK(image); filter->SetInput(input); filter->Update(); mOutputImage=vvImageFromITK(filter->GetOutput()); + // std::ostringstream osstream; + // osstream << "MIP_" << mCurrentSlicerManager->GetSlicer(0)->GetFileName() << ".mhd"; + // AddImage(mOutputImage,osstream.str()); }