//--------------------------------------------------------------------
+ template<class ImageType, class LabelType>
+ typename itk::LabelMap< itk::ShapeLabelObject<LabelType, ImageType::ImageDimension> >::Pointer
+ ComputeLabelMap(const ImageType * image,
+ typename ImageType::PixelType BG,
+ bool computePerimeterFlag=false);
template<class ImageType>
void
ComputeCentroids(const ImageType * image,
//--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ template<class ImageType>
+ typename ImageType::Pointer
+ Clone(const ImageType * input);
+ //--------------------------------------------------------------------
+
+
}
#include "clitkSegmentationUtils.txx"
#include <itkConstantPadImageFilter.h>
#include <itkImageSliceIteratorWithIndex.h>
#include <itkBinaryMorphologicalOpeningImageFilter.h>
+#include <itkImageDuplicator.h>
namespace clitk {
//--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ template<class ImageType, class LabelType>
+ typename itk::LabelMap< itk::ShapeLabelObject<LabelType, ImageType::ImageDimension> >::Pointer
+ ComputeLabelMap(const ImageType * image,
+ typename ImageType::PixelType BG,
+ bool computePerimeterFlag)
+ {
+ static const unsigned int Dim = ImageType::ImageDimension;
+ typedef itk::ShapeLabelObject< LabelType, Dim > LabelObjectType;
+ typedef itk::LabelMap< LabelObjectType > LabelMapType;
+ typedef itk::LabelImageToLabelMapFilter<ImageType, LabelMapType> ImageToMapFilterType;
+ typename ImageToMapFilterType::Pointer imageToLabelFilter = ImageToMapFilterType::New();
+ typedef itk::ShapeLabelMapFilter<LabelMapType, ImageType> ShapeFilterType;
+ typename ShapeFilterType::Pointer statFilter = ShapeFilterType::New();
+ imageToLabelFilter->SetBackgroundValue(BG);
+ imageToLabelFilter->SetInput(image);
+ statFilter->SetInput(imageToLabelFilter->GetOutput());
+ statFilter->SetComputePerimeter(computePerimeterFlag);
+ statFilter->Update();
+ return statFilter->GetOutput();
+ }
+ //--------------------------------------------------------------------
+
+
//--------------------------------------------------------------------
template<class ImageType>
void
//--------------------------------------------------------------------
+ //--------------------------------------------------------------------
+ template<class ImageType>
+ typename ImageType::Pointer
+ Clone(const ImageType * input) {
+ typedef itk::ImageDuplicator<ImageType> DuplicatorType;
+ typename DuplicatorType::Pointer duplicator = DuplicatorType::New();
+ duplicator->SetInputImage(input);
+ duplicator->Update();
+ return duplicator->GetOutput();
+ }
+ //--------------------------------------------------------------------
+
+
} // end of namespace
ADD_EXECUTABLE(clitkExtractBones clitkExtractBones.cxx ${clitkExtractBones_GGO_C})
TARGET_LINK_LIBRARIES(clitkExtractBones clitkCommon ${ITK_LIBRARIES} clitkSegmentationGgoLib)
+ WRAP_GGO(clitkBool_GGO_C clitkBool.ggo)
+ ADD_EXECUTABLE(clitkBool clitkBool.cxx ${clitkBool_GGO_C})
+ TARGET_LINK_LIBRARIES(clitkBool clitkCommon ${ITK_LIBRARIES} clitkSegmentationGgoLib)
+
WRAP_GGO(clitkExtractMediastinum_GGO_C clitkExtractMediastinum.ggo)
ADD_EXECUTABLE(clitkExtractMediastinum clitkExtractMediastinum.cxx ${clitkExtractMediastinum_GGO_C})
TARGET_LINK_LIBRARIES(clitkExtractMediastinum clitkCommon clitkSegmentationGgoLib ${ITK_LIBRARIES})
- # WRAP_GGO(clitkExtractLymphStations_GGO_C clitkExtractLymphStations.ggo)
- # ADD_EXECUTABLE(clitkExtractLymphStations clitkExtractLymphStations.cxx clitkFilterWithAnatomicalFeatureDatabaseManagement.cxx ${clitkExtractLymphStations_GGO_C})
- # TARGET_LINK_LIBRARIES(clitkExtractLymphStations clitkSegmentationGgoLib clitkCommon vtkHybrid)
+ WRAP_GGO(clitkExtractLymphStations_GGO_C clitkExtractLymphStations.ggo)
+ ADD_EXECUTABLE(clitkExtractLymphStations clitkExtractLymphStations.cxx clitkFilterWithAnatomicalFeatureDatabaseManagement.cxx ${clitkExtractLymphStations_GGO_C})
+ TARGET_LINK_LIBRARIES(clitkExtractLymphStations clitkSegmentationGgoLib clitkCommon vtkHybrid)
- # WRAP_GGO(clitkExtractMediastinalVessels_GGO_C clitkExtractMediastinalVessels.ggo)
- # ADD_EXECUTABLE(clitkExtractMediastinalVessels clitkExtractMediastinalVessels.cxx clitkFilterWithAnatomicalFeatureDatabaseManagement.cxx ${clitkExtractMediastinalVessels_GGO_C})
- # TARGET_LINK_LIBRARIES(clitkExtractMediastinalVessels clitkSegmentationGgoLib clitkCommon vtkHybrid)
+ WRAP_GGO(clitkExtractMediastinalVessels_GGO_C clitkExtractMediastinalVessels.ggo)
+ ADD_EXECUTABLE(clitkExtractMediastinalVessels clitkExtractMediastinalVessels.cxx clitkFilterWithAnatomicalFeatureDatabaseManagement.cxx ${clitkExtractMediastinalVessels_GGO_C})
+ TARGET_LINK_LIBRARIES(clitkExtractMediastinalVessels clitkSegmentationGgoLib clitkCommon vtkHybrid)
WRAP_GGO(clitkMorphoMath_GGO_C clitkMorphoMath.ggo)
ADD_EXECUTABLE(clitkMorphoMath clitkMorphoMath.cxx ${clitkMorphoMath_GGO_C})
--- /dev/null
+/*=========================================================================
+ Program: vv http://www.creatis.insa-lyon.fr/rio/vv
+
+ Authors belong to:
+ - University of LYON http://www.universite-lyon.fr/
+ - Léon Bérard cancer center http://oncora1.lyon.fnclcc.fr
+ - CREATIS CNRS laboratory http://www.creatis.insa-lyon.fr
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the copyright notices for more information.
+
+ It is distributed under dual licence
+
+ - BSD See included LICENSE.txt file
+ - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+======================================================================-====*/
+
+// clitk
+#include "clitkBool_ggo.h"
+#include "clitkBooleanOperatorLabelImageGenericFilter.h"
+
+//--------------------------------------------------------------------
+int main(int argc, char * argv[])
+{
+
+ // Init command line
+ GGO(clitkBool, args_info);
+ CLITK_INIT;
+
+ // Filter
+ typedef clitk::BooleanOperatorLabelImageGenericFilter<args_info_clitkBool> FilterType;
+ FilterType::Pointer filter = FilterType::New();
+
+ filter->SetArgsInfo(args_info);
+
+ try {
+ filter->Update();
+ } catch(std::runtime_error e) {
+ std::cout << e.what() << std::endl;
+ }
+
+ return EXIT_SUCCESS;
+} // This is the end, my friend
+//--------------------------------------------------------------------
--- /dev/null
+#File clitkExtractMediastinalVessels.ggo
+package "clitkExtractMediastinalVessels"
+version "1.0"
+purpose "Extract MediastinalVessels"
+
+option "config" - "Config file" string no
+option "imagetypes" - "Display allowed image types" flag off
+option "verbose" v "Verbose" flag off
+
+option "input" i "Input mask 1" string yes
+option "input2" j "Input mask 2" string yes
+option "output" o "Output filename" string yes
+
+option "type" t "Bool type : " int default="1" no
--- /dev/null
+/*=========================================================================
+ Program: vv http://www.creatis.insa-lyon.fr/rio/vv
+
+ Authors belong to:
+ - University of LYON http://www.universite-lyon.fr/
+ - Léon Bérard cancer center http://oncora1.lyon.fnclcc.fr
+ - CREATIS CNRS laboratory http://www.creatis.insa-lyon.fr
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the copyright notices for more information.
+
+ It is distributed under dual licence
+
+ - BSD See included LICENSE.txt file
+ - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+======================================================================-====*/
+
+#ifndef CLITKBOOLEANOPERATORLABELIMAGEGENERICFILTER_H
+#define CLITKBOOLEANOPERATORLABELIMAGEGENERICFILTER_H
+
+#include "clitkIO.h"
+#include "clitkImageToImageGenericFilter.h"
+#include "clitkBooleanOperatorLabelImageFilter.h"
+
+//--------------------------------------------------------------------
+namespace clitk
+{
+
+ template<class ArgsInfoType>
+ class ITK_EXPORT BooleanOperatorLabelImageGenericFilter:
+ public ImageToImageGenericFilter<BooleanOperatorLabelImageGenericFilter<ArgsInfoType> >
+ {
+
+ public:
+ //--------------------------------------------------------------------
+ BooleanOperatorLabelImageGenericFilter();
+
+ //--------------------------------------------------------------------
+ typedef ImageToImageGenericFilter<BooleanOperatorLabelImageGenericFilter<ArgsInfoType> > Superclass;
+ typedef BooleanOperatorLabelImageGenericFilter Self;
+ typedef itk::SmartPointer<Self> Pointer;
+ typedef itk::SmartPointer<const Self> ConstPointer;
+
+ //--------------------------------------------------------------------
+ itkNewMacro(Self);
+ itkTypeMacro(BooleanOperatorLabelImageGenericFilter, LightObject);
+
+ //--------------------------------------------------------------------
+ // Options for the GenericFilter
+ void SetArgsInfo(const ArgsInfoType & a);
+
+ //--------------------------------------------------------------------
+ // Options for the Filter
+ template<class FilterType>
+ void SetOptionsFromArgsInfoToFilter(FilterType * f) ;
+
+ //--------------------------------------------------------------------
+ // Main function called each time the filter is updated
+ template<class ImageType>
+ void UpdateWithInputImageType();
+
+ protected:
+ template<unsigned int Dim> void InitializeImageType();
+ ArgsInfoType mArgsInfo;
+
+ private:
+ BooleanOperatorLabelImageGenericFilter(const Self&); //purposely not implemented
+ void operator=(const Self&); //purposely not implemented
+
+ }; // end class
+ //--------------------------------------------------------------------
+
+} // end namespace clitk
+
+#ifndef ITK_MANUAL_INSTANTIATION
+#include "clitkBooleanOperatorLabelImageGenericFilter.txx"
+#endif
+
+#endif // #define CLITKBOOLEANOPERATORLABELIMAGEGENERICFILTER_H
--- /dev/null
+/*=========================================================================
+ Program: vv http://www.creatis.insa-lyon.fr/rio/vv
+
+ Authors belong to:
+ - University of LYON http://www.universite-lyon.fr/
+ - Léon Bérard cancer center http://oncora1.lyon.fnclcc.fr
+ - CREATIS CNRS laboratory http://www.creatis.insa-lyon.fr
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the copyright notices for more information.
+
+ It is distributed under dual licence
+
+ - BSD See included LICENSE.txt file
+ - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+ ======================================================================-====*/
+
+#ifndef CLITKBOOLEANOPERATORLABELIMAGEGENERICFILTER_TXX
+#define CLITKBOOLEANOPERATORLABELIMAGEGENERICFILTER_TXX
+
+#include "clitkImageCommon.h"
+
+//--------------------------------------------------------------------
+template<class ArgsInfoType>
+clitk::BooleanOperatorLabelImageGenericFilter<ArgsInfoType>::BooleanOperatorLabelImageGenericFilter():
+ ImageToImageGenericFilter<Self>("BooleanOperatorLabelImage")
+{
+ // Default values
+ cmdline_parser_clitkBool_init(&mArgsInfo);
+ InitializeImageType<3>(); // Only for 3D images
+}
+//--------------------------------------------------------------------
+
+
+//--------------------------------------------------------------------
+template<class ArgsInfoType>
+template<unsigned int Dim>
+void clitk::BooleanOperatorLabelImageGenericFilter<ArgsInfoType>::InitializeImageType()
+{
+ ADD_IMAGE_TYPE(Dim, uchar); // Can add float later
+}
+//--------------------------------------------------------------------
+
+
+//--------------------------------------------------------------------
+template<class ArgsInfoType>
+void clitk::BooleanOperatorLabelImageGenericFilter<ArgsInfoType>::SetArgsInfo(const ArgsInfoType & a)
+{
+ mArgsInfo=a;
+ SetIOVerbose(mArgsInfo.verbose_flag);
+ if (mArgsInfo.imagetypes_flag) this->PrintAvailableImageTypes();
+ if (mArgsInfo.input_given) AddInputFilename(mArgsInfo.input_arg);
+ if (mArgsInfo.input2_given) AddInputFilename(mArgsInfo.input2_arg);
+}
+//--------------------------------------------------------------------
+
+
+//--------------------------------------------------------------------
+template<class ArgsInfoType>
+template<class FilterType>
+void
+clitk::BooleanOperatorLabelImageGenericFilter<ArgsInfoType>::
+SetOptionsFromArgsInfoToFilter(FilterType * f)
+{
+ // Operation type
+ f->SetOperationType(typename FilterType::OperationTypeEnumeration(mArgsInfo.type_arg));
+
+ // Output filename
+ this->AddOutputFilename(mArgsInfo.output_arg);
+}
+//--------------------------------------------------------------------
+
+
+//--------------------------------------------------------------------
+// Update with the number of dimensions and the pixeltype
+//--------------------------------------------------------------------
+template<class ArgsInfoType>
+template<class ImageType>
+void clitk::BooleanOperatorLabelImageGenericFilter<ArgsInfoType>::UpdateWithInputImageType()
+{
+ // Reading input
+ typename ImageType::Pointer input1 = this->template GetInput<ImageType>(0);
+ typename ImageType::Pointer input2 = this->template GetInput<ImageType>(1);
+
+ // Create filter
+ typedef clitk::BooleanOperatorLabelImageFilter<ImageType> FilterType;
+ typename FilterType::Pointer filter = FilterType::New();
+
+ // Set global Options
+ filter->SetInput1(input1);
+ filter->SetInput2(input2);
+ SetOptionsFromArgsInfoToFilter<FilterType>(filter);
+
+ // Go !
+ filter->Update();
+
+ // Write/Save results
+ typename ImageType::Pointer output = filter->GetOutput();
+ this->template SetNextOutput<ImageType>(output);
+}
+//--------------------------------------------------------------------
+
+#endif //#define CLITKBOOLEANOPERATORLABELIMAGEGENERICFILTER_TXX
option "doNotFillHoles" - "Do not fill holes if set" flag on
option "dir" d "Directions (axes) to perform filling (defaults to 2,1,0)" int multiple no
+option "noAutoCrop" - "If set : do no crop final mask to BoundingBox" flag off
itkGetConstMacro(FillHolesFlag, bool);
itkBooleanMacro(FillHolesFlag);
+ // Step Auto Crop
+ itkSetMacro(AutoCrop, bool);
+ itkGetConstMacro(AutoCrop, bool);
+ itkBooleanMacro(AutoCrop);
+
protected:
ExtractLungFilter();
virtual ~ExtractLungFilter() {}
MaskImagePixelType m_BackgroundValue;
MaskImagePixelType m_ForegroundValue;
int m_MinimalComponentSize;
+ bool m_AutoCrop;
// Step 1
InputImagePixelType m_UpperThreshold;
#include "itkImageIteratorWithIndex.h"
#include "itkBinaryMorphologicalOpeningImageFilter.h"
#include "itkBinaryMorphologicalClosingImageFilter.h"
+#include "itkConstantPadImageFilter.h"
//--------------------------------------------------------------------
template <class ImageType>
// Step 6
FillHolesFlagOn();
+ AutoCropOn();
}
//--------------------------------------------------------------------
StartNewStep("Set background to initial image");
working_input = SetBackground<ImageType, MaskImageType>
(working_input, patient, GetPatientMaskBackgroundValue(), -1000, true);
+
+ // Pad images with air to prevent patient touching the image border
+ static const unsigned int Dim = ImageType::ImageDimension;
+ typedef itk::ConstantPadImageFilter<ImageType, ImageType> PadFilterType;
+ typename PadFilterType::Pointer padFilter = PadFilterType::New();
+ padFilter->SetInput(working_input);
+ padFilter->SetConstant(-1000);
+ typename ImageType::SizeType bounds;
+ for (unsigned i = 0; i < Dim - 1; ++i)
+ bounds[i] = 1;
+ bounds[Dim - 1] = 0;
+ padFilter->SetPadLowerBound(bounds);
+ padFilter->SetPadUpperBound(bounds);
+ padFilter->Update();
+ working_input = padFilter->GetOutput();
+
StopCurrentStep<ImageType>(working_input);
PrintMemory(GetVerboseMemoryFlag(), "After set bg"); // OK, additional mem = 0
//--------------------------------------------------------------------
PrintMemory(GetVerboseMemoryFlag(), "before autocropfilter");
if (m_Seeds.size() != 0) { // if ==0 ->no trachea found
- trachea = clitk::AutoCrop<MaskImageType>(trachea, GetBackgroundValue());
+ if (GetAutoCrop())
+ trachea = clitk::AutoCrop<MaskImageType>(trachea, GetBackgroundValue());
+ else
+ {
+ // Remove Padding region
+ typedef itk::CropImageFilter<MaskImageType, MaskImageType> CropFilterType;
+ typename CropFilterType::Pointer cropFilter = CropFilterType::New();
+ cropFilter->SetInput(trachea);
+ cropFilter->SetLowerBoundaryCropSize(bounds);
+ cropFilter->SetUpperBoundaryCropSize(bounds);
+ cropFilter->Update();
+ trachea = cropFilter->GetOutput();
+ }
StopCurrentStep<MaskImageType>(trachea);
PrintMemory(GetVerboseMemoryFlag(), "after delete trachea");
}
//--------------------------------------------------------------------
StartNewStep("Cropping lung");
PrintMemory(GetVerboseMemoryFlag(), "Before Autocropfilter");
- working_mask = clitk::AutoCrop<MaskImageType>(working_mask, GetBackgroundValue());
+ if (GetAutoCrop())
+ working_mask = clitk::AutoCrop<MaskImageType>(working_mask, GetBackgroundValue());
+ else
+ {
+ // Remove Padding region
+ typedef itk::CropImageFilter<MaskImageType, MaskImageType> CropFilterType;
+ typename CropFilterType::Pointer cropFilter = CropFilterType::New();
+ cropFilter->SetInput(working_mask);
+ cropFilter->SetLowerBoundaryCropSize(bounds);
+ cropFilter->SetUpperBoundaryCropSize(bounds);
+ cropFilter->Update();
+ working_mask = cropFilter->GetOutput();
+ }
StopCurrentStep<MaskImageType>(working_mask);
//--------------------------------------------------------------------
PrintMemory(GetVerboseMemoryFlag(), "After count label");
// Decompose the first label
- static const unsigned int Dim = ImageType::ImageDimension;
if (initialNumberOfLabels<2) {
// Structuring element radius
typename ImageType::SizeType radius;
//--------------------------------------------------------------------
template <class ImageType>
-void
+void
clitk::ExtractLungFilter<ImageType>::
SearchForTrachea()
{
double volume = 0.0;
int skip = GetNumberOfSlicesToSkipBeforeSearchingSeed();
while (!stop) {
- stop = SearchForTracheaSeed(skip);
- if (stop) {
+ stop = true;
+ if (SearchForTracheaSeed(skip)) {
TracheaRegionGrowing();
volume = ComputeTracheaVolume()/1000; // assume mm3, so divide by 1000 to get cc
if (GetWriteStepFlag()) {
if (GetVerboseStepFlag()) {
std::cout << "\t Found trachea with volume " << volume << " cc." << std::endl;
}
- stop = true;
}
else {
if (GetVerboseStepFlag()) {
// empty the list of seed
m_Seeds.clear();
}
+ if (skip > 0.5 * working_input->GetLargestPossibleRegion().GetSize()[2]) {
+ // we want to skip more than a half of the image, it is probably a bug
+ std::cerr << "2 : Number of slices to skip to find trachea too high = " << skip << std::endl;
+ stop = true;
+ }
}
else {
stop = true;
f->SetOpenCloseFlag(mArgsInfo.openclose_flag);
f->SetOpenCloseRadius(mArgsInfo.opencloseRadius_arg);
+ f->SetAutoCrop(!mArgsInfo.noAutoCrop_flag);
if (mArgsInfo.doNotFillHoles_given)
f->SetFillHolesFlag(false);
output->SetOrigin(origin);
}
- // force index to zero
- typename ImageType::RegionType region;
- region = output->GetLargestPossibleRegion();
- typename ImageType::IndexType index;
+ // adjust image origin and force index to zero
+ typename ImageType::RegionType region = output->GetLargestPossibleRegion();
+ typename ImageType::IndexType index = region.GetIndex();
+ typename ImageType::PointType origin = output->GetOrigin();
+ typename ImageType::SpacingType spacing = output->GetSpacing();
+ if (mArgsInfo.verbose_flag) std::cout << "origin before crop " << origin << std::endl;
+ for (unsigned int i = 0; i < output->GetImageDimension(); i++)
+ origin[i] += index[i]*spacing[i];
+ if (mArgsInfo.verbose_flag) std::cout << "origin after crop " << origin << std::endl;
+ output->SetOrigin(origin);
+
index.Fill(itk::NumericTraits<double>::Zero);
region.SetIndex(index);
output->SetRegions(region);
-
+
// Write/Save results
this->template SetNextOutput<ImageType>(output);
}
option "output" o "Output image filename" string yes
option "scalar" s "Scalar value" double no
-option "operation" t "Type of operation : \n With another image : 0=add, 1=multiply, 2=divide,\n 3=max, 4=min, 5=absdiff, 6=squareddiff, 7=difference, 8=relativ diff\n For 'scalar' : 0=add, 1=multiply, 2=inverse,\n 3=max, 4=min 5=absval 6=squareval\n 7=log 8=exp 9=sqrt 10=EPID" int default="0" no
+option "operation" t "Type of operation : \n With another image : 0=add, 1=multiply, 2=divide,\n 3=max, 4=min, 5=absdiff, 6=squareddiff, 7=difference, 8=relativ diff\n For 'scalar' : 0=add, 1=multiply, 2=inverse,\n 3=max, 4=min 5=absval 6=squareval\n 7=log 8=exp 9=sqrt 10=EPID 11=divide 12=normalize (divide by max)" int default="0" no
option "pixelValue" - "Default value for NaN/Inf" double default="0.0" no
option "setFloatOutput" f "Set output to float pixel type" flag off
#include "clitkImageCommon.h"
+#include "itkMinimumMaximumImageCalculator.h"
+
namespace clitk
{
typename ImageType::Pointer input2 = NULL;
IteratorType it2;
+ // Special case for normalisation
+ if (mTypeOfOperation == 12) {
+ typedef itk::MinimumMaximumImageCalculator<ImageType> MinMaxFilterType;
+ typename MinMaxFilterType::Pointer ff = MinMaxFilterType::New();
+ ff->SetImage(input1);
+ ff->ComputeMaximum();
+ mScalar = ff->GetMaximum();
+ mTypeOfOperation = 11; // divide
+ }
if (mIsOperationUseASecondImage) {
// Read input2
++ito;
}
break;
+ case 11: // divide
+ while (!it.IsAtEnd()) {
+ ito.Set(PixelTypeDownCast<double, PixelType>((double)it.Get() / mScalar) );
+ ++it;
+ ++ito;
+ }
+ break;
default: // error ?
std::cerr << "ERROR : the operation number (" << mTypeOfOperation << ") is not known." << std::endl;
exit(-1);
ADD_EXECUTABLE(vv vv.cxx)
ENDIF(WIN32)
-TARGET_LINK_LIBRARIES(vv vvLib)
+#TARGET_LINK_LIBRARIES(vv vvLib)
+# QtNetwork added specifically for Fedora build
+TARGET_LINK_LIBRARIES(vv vvLib QtNetwork)
#=========================================================
<file>icons/adjustsize.png</file>
<file>icons/standardbutton-apply-16.png</file>
<file>icons/standardbutton-cancel-16.png</file>
+ <file>icons/identity.png</file>
</qresource>
</RCC>
//------------------------------------------------------------------------------
-//------------------------------------------------------------------------------
-void vvInfoPanel::setViews(int window, int view, int slice)
-{/*
- QString viewString;
- switch (view) {
- case 0: {
- viewString = "Sagital, ";
- break;
- }
- case 1: {
- viewString = "Coronal, ";
- break;
- }
- case 2: {
- viewString = "Axial, ";
- break;
- }
- }
-
- QString text = viewString;
- if (view != -1) {
- text += "current slice : ";
- text += QString::number(slice);
- } else {
- text = "Disable";
- }
-
- switch (window) {
- case 0: {
- ULLabel->setText(text);
- break;
- }
- case 1: {
- URLabel->setText(text);
- break;
- }
- case 2: {
- DLLabel->setText(text);
- break;
- }
- case 3: {
- DRLabel->setText(text);
- break;
- }
- }*/
-}
-//------------------------------------------------------------------------------
-
-
//------------------------------------------------------------------------------
void vvInfoPanel::setMemoryInMb(QString text)
{
void setDimension(QString text);
void setSizePixel(QString text);
void setCurrentInfo(int visibility, double x, double y, double z, double X, double Y, double Z, double value);
- void setViews(int window, int view, int slice);
void setMemoryInMb(QString text);
public slots:
connect(actionAdd_fusion_image,SIGNAL(triggered()),this,SLOT(SelectFusionImage()));
contextActions.push_back(actionAdd_fusion_image);
+ contextMenu.addSeparator();
+ QAction* actionResetMatrix = contextMenu.addAction(QIcon(QString::fromUtf8(":/common/icons/identity.png")),
+ tr("Reset transformation to identity"));
+ connect(actionResetMatrix, SIGNAL(triggered()), this,SLOT(ResetTransformationToIdentity()));
+
// TRIAL DS
/*
QMenu * m = new QMenu(menubar);
this, SLOT(OverlayChanged(int,double,double)));
connect(mSlicerManagers.back(), SIGNAL(UpdateFusion(int, double)),
this, SLOT(FusionChanged(int,double)));
- connect(mSlicerManagers.back(), SIGNAL(UpdateWindows(int, int, int)),
- this,SLOT(WindowsChanged(int, int, int)));
connect(mSlicerManagers.back(), SIGNAL(WindowLevelChanged(double, double,int, int)),
this,SLOT(WindowLevelChanged(double, double, int, int)));
connect(mSlicerManagers.back(), SIGNAL(UpdateSlice(int,int)),
}
//------------------------------------------------------------------------------
-//------------------------------------------------------------------------------
-void vvMainWindow::WindowsChanged(int window, int view, int slice)
-{
- infoPanel->setViews(window, view, slice);
-}
-//------------------------------------------------------------------------------
-
//------------------------------------------------------------------------------
void vvMainWindow::WindowLevelChanged(double window, double level,int preset,int colormap)
{
}
//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+void vvMainWindow::ResetTransformationToIdentity()
+{
+ std::string actorType = DataTree->selectedItems()[0]->data(1,Qt::UserRole).toString().toStdString();
+ int index = GetSlicerIndexFromItem(DataTree->selectedItems()[0]);
+ mSlicerManagers[index]->ResetTransformationToIdentity(actorType);
+ ImageInfoChanged();
+}
+//------------------------------------------------------------------------------
+
//------------------------------------------------------------------------------
void vvMainWindow::AddFusionImage(int index, QString file)
{
this, SLOT(OverlayChanged(int,double,double)));
connect(mSlicerManagers.back(), SIGNAL(UpdateFusion(int, double)),
this, SLOT(FusionChanged(int,double)));
- connect(mSlicerManagers.back(), SIGNAL(UpdateWindows(int, int, int)),
- this,SLOT(WindowsChanged(int, int, int)));
connect(mSlicerManagers.back(), SIGNAL(WindowLevelChanged(double, double,int, int)),
this,SLOT(WindowLevelChanged(double, double, int, int)));
connect(mSlicerManagers.back(), SIGNAL(UpdateSlice(int,int)),
void SegmentationOnCurrentImage();
void SurfaceViewerLaunch();
- void WindowsChanged(int window, int view, int slice);
void WindowLevelChanged(double window, double level,int preset, int colormap);
void UpdateSlice(int slicer, int slice);
void UpdateTSlice(int slicer, int slice);
void OpenField();
void SelectOverlayImage();
void SelectFusionImage();
+ void ResetTransformationToIdentity();
void SetVFProperty(int subsampling,int scale,int lut, int width, double r, double g, double b);
void SetOverlayProperty(int color);
};
-#include "vvMainWindow.txx"
-
#endif
+++ /dev/null
-/*=========================================================================
- Program: vv http://www.creatis.insa-lyon.fr/rio/vv
-
- Authors belong to:
- - University of LYON http://www.universite-lyon.fr/
- - Léon Bérard cancer center http://www.centreleonberard.fr
- - CREATIS CNRS laboratory http://www.creatis.insa-lyon.fr
-
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the copyright notices for more information.
-
- It is distributed under dual licence
-
- - BSD See included LICENSE.txt file
- - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
-===========================================================================**/
-// }
// Overlay image actor
if (mOverlay && mOverlayActor->GetVisibility()) {
+ AdjustResliceToSliceOrientation(mOverlayReslice);
int overExtent[6];
- mOverlayReslice->GetOutput()->UpdateInformation();
this->ConvertImageToImageDisplayExtent(input, w_ext, mOverlayReslice->GetOutput(), overExtent);
ClipDisplayedExtent(overExtent, mOverlayMapper->GetInput()->GetWholeExtent());
mOverlayActor->SetDisplayExtent( overExtent );
// Fusion image actor
if (mFusion && mFusionActor->GetVisibility()) {
+ AdjustResliceToSliceOrientation(mFusionReslice);
int fusExtent[6];
- mFusionReslice->GetOutput()->UpdateInformation();
this->ConvertImageToImageDisplayExtent(input, w_ext, mFusionReslice->GetOutput(), fusExtent);
ClipDisplayedExtent(fusExtent, mFusionMapper->GetInput()->GetWholeExtent());
mFusionActor->SetDisplayExtent(fusExtent);
}
//----------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+void vvSlicerManager::ResetTransformationToIdentity(const std::string actorType)
+{
+ if(actorType == "image")
+ this->GetImage()->GetTransform()->Identity();
+ else if(actorType == "overlay")
+ this->GetSlicer(0)->GetOverlay()->GetTransform()->Identity();
+ else if(actorType == "fusion")
+ this->GetSlicer(0)->GetFusion()->GetTransform()->Identity();
+ else if(actorType == "vf")
+ this->GetVF()->GetTransform()->Identity();
+ else
+ return;
+
+ for(int i=0; i< this->GetNumberOfSlicers(); i++){
+ this->GetSlicer(i)->ForceUpdateDisplayExtent();
+ this->GetSlicer(i)->ResetCamera();
+ this->GetSlicer(i)->Render();
+ }
+}
+//------------------------------------------------------------------------------
//----------------------------------------------------------------------------
void vvSlicerManager::Render()
void UpdateViews(int current, int slicer);
void UpdateLinked(int slicer);
void UpdateLinkedNavigation(vvSlicer *slicer, bool bPropagate=false);
+ void ResetTransformationToIdentity(const std::string actorType);
void Render();
void AddLink(std::string newId) {
void UpdateVector(int display, double x, double y, double z, double value);
void UpdateOverlay(int display, double valueOver, double valueRef);
void UpdateFusion(int display, double valueFus);
- void UpdateWindows(int slicer, int view, int slice);
void UpdateOrientation(int slicer, int orientation);
void UpdateSlice(int slicer, int slice);
void UpdateTSlice(int slicer, int slice);