#include <vtkImageStencil.h>
#include <vtkLinearExtrusionFilter.h>
#include <vtkMetaImageWriter.h>
-#include <vtkVersion.h>
//--------------------------------------------------------------------
#if VTK_MAJOR_VERSION <= 5
sts->SetInput(extrude->GetOutput());
#else
- sts->SetInputData(extrude->GetOutput());
+ sts->SetInputConnection(extrude->GetOutputPort());
#endif
// When extrude ScaleFactor indicate the extrusion scaling (default = 1)
target_link_libraries(clitkUnsharpMask clitkCommon )
set(TOOLS_INSTALL ${TOOLS_INSTALL} clitkUnsharpMask)
- WRAP_GGO(clitkFooImage_GGO_C clitkFooImage.ggo)
- add_executable(clitkFooImage clitkFooImage.cxx ${clitkFooImage_GGO_C})
- target_link_libraries(clitkFooImage clitkCommon )
- set(TOOLS_INSTALL ${TOOLS_INSTALL} clitkFooImage)
-
WRAP_GGO(clitkMedianImageFilter_GGO_C clitkMedianImageFilter.ggo)
add_executable(clitkMedianImageFilter clitkMedianImageFilter.cxx ${clitkMedianImageFilter_GGO_C})
target_link_libraries(clitkMedianImageFilter clitkMedianImageFilterLib clitkCommon)
target_link_libraries(clitkMIP clitkMIPLib clitkCommon)
set(TOOLS_INSTALL ${TOOLS_INSTALL} clitkMIP)
+ WRAP_GGO(clitkSum_GGO_C clitkSum.ggo)
+ add_executable(clitkSum clitkSum.cxx ${clitkSum_GGO_C})
+ target_link_libraries(clitkSum clitkCommon)
+ set(TOOLS_INSTALL ${TOOLS_INSTALL} clitkSum)
+
WRAP_GGO(clitkTransformLandmarks_GGO_C clitkTransformLandmarks.ggo)
add_executable(clitkTransformLandmarks clitkTransformLandmarks.cxx ${clitkTransformLandmarks_GGO_C})
target_link_libraries(clitkTransformLandmarks clitkCommon)
- CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
===========================================================================**/
-/* =================================================
- * @file clitkFooImageGenericFilter.txx
- * @author xxx <xxx@creatis.insa-lyon.fr>
- * @date 29 June 2029
- *
- * @brief FooImage an image
- *
- ===================================================*/
-
// clitk
#include "clitkFooImage_ggo.h"
#include "clitkFooImageGenericFilter.h"
option "input" i "Input image filename" string required
option "output" o "Output image filename" string required
-option "lower" l "Lower intensity (default=min), fg is greater than this value" double optional
-option "upper" u "Upper intensity (default=max), fg is lower than this value" double optional
-option "fg" - "Foreground (FG) or 'inside' value" double optional default="1"
-option "bg" - "Background (BG) or 'ouside' value" double optional default="0"
-option "mode" - "Use FG and/or BG values (if FG, the BG is replaced by the input image values)" values="FG","BG","both" default="both" optional
- BSD See included LICENSE.txt file
- CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
===========================================================================**/
-#ifndef CLITKFooIMAGEGENERICFILTER_H
-#define CLITKFooIMAGEGENERICFILTER_H
+#ifndef clitkFooImageGenericFilter_h
+#define clitkFooImageGenericFilter_h
#include "clitkIO.h"
#include "clitkImageToImageGenericFilter.h"
#ifndef clitkFooImageGenericFilter_txx
#define clitkFooImageGenericFilter_txx
-/* =================================================
- * @file clitkFooImageGenericFilter.txx
- * @author Jef Vandemeulebroucke <jef@creatis.insa-lyon.fr>
- * @date 29 june 2009
- *
- * @brief
- *
- ===================================================*/
-
// itk include
#include "itkBinaryThresholdImageFilter.h"
#include "itkMaskImageFilter.h"
typedef itk::BinaryThresholdImageFilter<InputImageType, OutputImageType> BinaryThresholdImageFilterType;
typename BinaryThresholdImageFilterType::Pointer thresholdFilter=BinaryThresholdImageFilterType::New();
thresholdFilter->SetInput(input);
- thresholdFilter->SetInsideValue(mArgsInfo.fg_arg);
-
- if (mArgsInfo.lower_given) thresholdFilter->SetLowerThreshold(static_cast<PixelType>(mArgsInfo.lower_arg));
- if (mArgsInfo.upper_given) thresholdFilter->SetUpperThreshold(static_cast<PixelType>(mArgsInfo.upper_arg));
-
- if (mArgsInfo.mode_arg == std::string("both")) {
- thresholdFilter->SetOutsideValue(mArgsInfo.bg_arg);
- thresholdFilter->Update();
-
- typename OutputImageType::Pointer outputImage = thresholdFilter->GetOutput();
- this->template SetNextOutput<OutputImageType>(outputImage);
- } else {
- typename InputImageType::Pointer outputImage;
- thresholdFilter->SetOutsideValue(0);
- if (mArgsInfo.mode_arg == std::string("BG")) {
- typedef itk::MaskImageFilter<InputImageType,OutputImageType> maskFilterType;
- typename maskFilterType::Pointer maskFilter = maskFilterType::New();
- maskFilter->SetInput1(input);
- maskFilter->SetInput2(thresholdFilter->GetOutput());
- maskFilter->SetOutsideValue(mArgsInfo.bg_arg);
- maskFilter->Update();
- outputImage = maskFilter->GetOutput();
- } else {
- typedef itk::MaskNegatedImageFilter<InputImageType,OutputImageType> maskFilterType;
- typename maskFilterType::Pointer maskFilter = maskFilterType::New();
- maskFilter->SetInput1(input);
- maskFilter->SetInput2(thresholdFilter->GetOutput());
- maskFilter->SetOutsideValue(mArgsInfo.fg_arg);
- maskFilter->Update();
- outputImage = maskFilter->GetOutput();
- }
- // Write/Save results
- this->template SetNextOutput<InputImageType>(outputImage);
- }
+ // Set filter members
+
+ // Write/Save results
+ typename OutputImageType::Pointer outputImage = thresholdFilter->GetOutput();
+ this->template SetNextOutput<OutputImageType>(outputImage);
}
//--------------------------------------------------------------------
--- /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
+===========================================================================**/
+
+// clitk
+#include "clitkSum_ggo.h"
+#include "clitkSumGenericFilter.h"
+
+//--------------------------------------------------------------------
+int main(int argc, char * argv[])
+{
+
+ // Init command line
+ GGO(clitkSum, args_info);
+ CLITK_INIT;
+
+ // Filter
+ typedef clitk::SumGenericFilter<args_info_clitkSum> 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;
+}// end main
+
+//--------------------------------------------------------------------
--- /dev/null
+#File clitkSum.ggo
+package "clitkSum"
+version "1.0"
+purpose ""
+
+option "config" - "Config file" string optional
+option "verbose" v "Verbose" flag off
+
+option "imagetypes" - "Display allowed image types" flag off
+
+option "input" i "Input image filename" string required
+option "output" o "Output image filename" string required
+option "dimension" d "Dimension along which to sum" int yes
--- /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
+===========================================================================**/
+#ifndef clitkSumGenericFilter_h
+#define clitkSumGenericFilter_h
+#include "clitkIO.h"
+#include "clitkImageToImageGenericFilter.h"
+
+//--------------------------------------------------------------------
+namespace clitk
+{
+
+template<class args_info_type>
+class ITK_EXPORT SumGenericFilter:
+ public ImageToImageGenericFilter<SumGenericFilter<args_info_type> >
+{
+
+public:
+
+ //--------------------------------------------------------------------
+ SumGenericFilter();
+
+ //--------------------------------------------------------------------
+ typedef SumGenericFilter Self;
+ typedef itk::SmartPointer<Self> Pointer;
+ typedef itk::SmartPointer<const Self> ConstPointer;
+
+ //--------------------------------------------------------------------
+ // Method for creation through the object factory
+ // and Run-time type information (and related methods)
+ itkNewMacro(Self);
+ itkTypeMacro(SumGenericFilter, LightObject);
+
+ //--------------------------------------------------------------------
+ void SetArgsInfo(const args_info_type & a);
+
+ //--------------------------------------------------------------------
+ // Main function called each time the filter is updated
+ template<class InputImageType>
+ void UpdateWithInputImageType();
+
+protected:
+ template<unsigned int Dim> void InitializeImageType();
+ args_info_type mArgsInfo;
+
+}; // end class
+//--------------------------------------------------------------------
+
+} // end namespace clitk
+
+#ifndef ITK_MANUAL_INSTANTIATION
+#include "clitkSumGenericFilter.txx"
+#endif
+
+#endif // #define clitkSumGenericFilter_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://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
+===========================================================================**/
+#ifndef clitkSumGenericFilter_txx
+#define clitkSumGenericFilter_txx
+
+// itk include
+#include <itkSumProjectionImageFilter.h>
+#include <clitkCommon.h>
+
+namespace clitk
+{
+
+//--------------------------------------------------------------------
+template<class args_info_type>
+SumGenericFilter<args_info_type>::SumGenericFilter():
+ ImageToImageGenericFilter<Self>("Sum")
+{
+ InitializeImageType<3>();
+ InitializeImageType<4>();
+}
+//--------------------------------------------------------------------
+
+
+//--------------------------------------------------------------------
+template<class args_info_type>
+template<unsigned int Dim>
+void SumGenericFilter<args_info_type>::InitializeImageType()
+{
+ ADD_DEFAULT_IMAGE_TYPES(Dim);
+}
+//--------------------------------------------------------------------
+
+
+//--------------------------------------------------------------------
+template<class args_info_type>
+void SumGenericFilter<args_info_type>::SetArgsInfo(const args_info_type & a)
+{
+ mArgsInfo=a;
+ this->SetIOVerbose(mArgsInfo.verbose_flag);
+ if (mArgsInfo.imagetypes_flag) this->PrintAvailableImageTypes();
+
+ if (mArgsInfo.input_given) {
+ this->SetInputFilename(mArgsInfo.input_arg);
+ }
+ if (mArgsInfo.output_given) {
+ this->SetOutputFilename(mArgsInfo.output_arg);
+ }
+}
+//--------------------------------------------------------------------
+
+//--------------------------------------------------------------------
+// Update with the number of dimensions and the pixeltype
+//--------------------------------------------------------------------
+template<class args_info_type>
+template<class InputImageType>
+void
+SumGenericFilter<args_info_type>::UpdateWithInputImageType()
+{
+
+ // Reading input
+ typename InputImageType::Pointer input = this->template GetInput<InputImageType>(0);
+
+ // Main filter
+ typedef typename InputImageType::PixelType PixelType;
+ const int Dim = InputImageType::ImageDimension;
+ typedef itk::Image<PixelType,Dim> ImageType;
+ typedef itk::Image<PixelType,Dim-1> OutputImageType;
+
+ // Filter
+ typedef itk::SumProjectionImageFilter<ImageType,OutputImageType> FilterType;
+ typename FilterType::Pointer filter = FilterType::New();
+ filter->SetProjectionDimension(mArgsInfo.dimension_arg);
+ filter->SetInput(input);
+ filter->Update();
+ this->template SetNextOutput<OutputImageType>(filter->GetOutput());
+}
+//--------------------------------------------------------------------
+
+
+}//end clitk
+
+#endif //#define clitkSumGenericFilter_txx
vvToolROIManager
vvToolSegmentation
## these ones are for tests (not working)
+ # vvToolTest
# vvToolFoo
# vvToolFooWithWidgetBase
# vvToolPlastimatch
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>vvToolTest</class>
+ <widget class="QWidget" name="vvToolTest">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>433</width>
+ <height>222</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Test sphere</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="Line" name="line_3">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
#if VTK_MAJOR_VERSION <= 5
quant->SetInput(RGBvolume->GetOutput());
#else
- quant->SetInputData(RGBvolume->GetOutput());
+ quant->SetInputConnection(RGBvolume->GetOutputPort());
#endif
quant->Update();
#if VTK_MAJOR_VERSION <= 5
cast->SetInput( quant->GetOutput() );
#else
- cast->SetInputData( quant->GetOutput() );
+ cast->SetInputConnection( quant->GetOutputPort() );
#endif
cast->SetOutputScalarTypeToUnsignedChar();
cast->Update();
#include <vtkProperty.h>
#include <vtkImageMapToRGBA.h>
#include <vtkLookupTable.h>
+#include <vtkImageMapper3D.h>
//------------------------------------------------------------------------------
vvBinaryImageOverlayActor::vvBinaryImageOverlayActor()
-{
+{ //out << __func__ << endl;
mTSlice = -1;
mSlice = 0;
mColor.resize(3);
//------------------------------------------------------------------------------
vvBinaryImageOverlayActor::~vvBinaryImageOverlayActor()
-{
+{ //out << __func__ << endl;
mImageActorList.clear();
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void vvBinaryImageOverlayActor::RemoveActors()
-{
+{ //out << __func__ << endl;
for (unsigned int i = 0; i < mImageActorList.size(); i++) {
if (mSlicer != 0) {
if (mSlicer != NULL) {
//------------------------------------------------------------------------------
void vvBinaryImageOverlayActor::SetColor(double r, double g, double b)
-{
+{ //out << __func__ << endl;
mColor[0] = r;
mColor[1] = g;
mColor[2] = b;
//------------------------------------------------------------------------------
void vvBinaryImageOverlayActor::SetSlicer(vvSlicer * slicer)
-{
+{ //out << __func__ << endl;
mSlicer = slicer;
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void vvBinaryImageOverlayActor::Initialize(bool IsVisible)
-{
+{ //out << __func__ << endl;
if (!mSlicer) {
std::cerr << "ERROR. Please use setSlicer before setSlicer in vvBinaryImageOverlayActor." << std::endl;
exit(0);
#if VTK_MAJOR_VERSION <= 5
mOverlayActor->SetInput(mOverlayMapper->GetOutput());
#else
- mOverlayActor->SetInputData(mOverlayMapper->GetOutput());
+ mOverlayActor->GetMapper()->SetInputConnection(mOverlayMapper->GetOutputPort());
#endif
mOverlayActor->SetPickable(0);
mOverlayActor->SetVisibility(IsVisible);
//------------------------------------------------------------------------------
void vvBinaryImageOverlayActor::SetOpacity(double d)
-{
+{ //out << __func__ << endl;
mAlpha = d;
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void vvBinaryImageOverlayActor::SetImage(vvImage::Pointer image, double bg, bool modeBG)
-{
+{ //out << __func__ << endl;
mImage = image;
if (modeBG) {
mBackgroundValue = bg;
//------------------------------------------------------------------------------
void vvBinaryImageOverlayActor::HideActors()
-{
+{ //out << __func__ << endl;
if (!mSlicer) return;
mSlice = mSlicer->GetSlice();
for(unsigned int i=0; i<mImageActorList.size(); i++) {
//------------------------------------------------------------------------------
void vvBinaryImageOverlayActor::ShowActors()
-{
+{ //out << __func__ << endl;
if (!mSlicer) return;
mSlice = mSlicer->GetSlice();
mTSlice = mSlicer->GetTSlice();
//------------------------------------------------------------------------------
void vvBinaryImageOverlayActor::UpdateColor()
-{
+{ //out << __func__ << endl;
mColorLUT->SetTableValue(1, mColor[0], mColor[1], mColor[2], mAlpha); // FG
for (unsigned int numImage = 0; numImage < mSlicer->GetImage()->GetVTKImages().size(); numImage++) {
// how many intensity ?
//------------------------------------------------------------------------------
void vvBinaryImageOverlayActor::UpdateSlice(int slicer, int slice, bool force)
-{
+{ //out << __func__ << endl;
if (!mSlicer) return;
if (!force) {
int slice,
int * inExtent,
int * outExtent)
-{
+{ //out << __func__ << endl;
switch (orientation) {
case vtkImageViewer2::SLICE_ORIENTATION_XY:
for(int i=0; i<4; i++) outExtent[i] = inExtent[i];
//----------------------------------------------------------------------------
void vvBinaryImageOverlayActor::ComputeExtent(int * inExtent, int * outExtent, vtkImageData * image, vtkImageData * overlay)
-{
+{ //out << __func__ << endl;
for(int i=0; i<3; i++) {
double a = (image->GetOrigin()[i] + inExtent[i*2]*image->GetSpacing()[i] -
overlay->GetOrigin()[i]) / overlay->GetSpacing()[i];
int * extent,
vtkImageActor * actor,
double position)
-{
+{ //out << __func__ << endl;
/* FIXME
Error according to camera orientation
*/
#include <vtkImageData.h>
#include <vtkPolyDataMapper.h>
#include <vtkProperty.h>
+#include <vtkInformation.h>
//------------------------------------------------------------------------------
vvImageContour::vvImageContour()
-{
+{ //out << __func__ << endl;
mTSlice = -1;
mSlice = 0;
mHiddenImageIsUsed = false;
//------------------------------------------------------------------------------
vvImageContour::~vvImageContour()
-{
+{ //out << __func__ << endl;
mSquaresActorList.clear();
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void vvImageContour::RemoveActors()
-{
+{ //out << __func__ << endl;
for (unsigned int i = 0; i < mSquaresActorList.size(); i++) {
if (mSlicer != 0) {
if (mSlicer!= NULL) {
//------------------------------------------------------------------------------
-void vvImageContour::SetSlicer(vvSlicer * slicer) {
+void vvImageContour::SetSlicer(vvSlicer * slicer)
+{ //out << __func__ << endl;
mSlicer = slicer;
// Create an actor for each time slice
for (unsigned int numImage = 0; numImage < mSlicer->GetImage()->GetVTKImages().size(); numImage++) {
//------------------------------------------------------------------------------
-void vvImageContour::SetImage(vvImage::Pointer image) {
+void vvImageContour::SetImage(vvImage::Pointer image)
+{ //out << __func__ << endl;
for (unsigned int numImage = 0; numImage < image->GetVTKImages().size(); numImage++) {
#if VTK_MAJOR_VERSION <= 5
mClipperList[numImage]->SetInput(image->GetVTKImages()[numImage]);
//------------------------------------------------------------------------------
-void vvImageContour::SetPreserveMemoryModeEnabled(bool b) {
+void vvImageContour::SetPreserveMemoryModeEnabled(bool b)
+{ //out << __func__ << endl;
// FastCache mode work only if threshold is always the same
if (mDisplayModeIsPreserveMemory == b) return;
mDisplayModeIsPreserveMemory = b;
//------------------------------------------------------------------------------
-void vvImageContour::SetColor(double r, double g, double b) {
+void vvImageContour::SetColor(double r, double g, double b)
+{ //out << __func__ << endl;
for(unsigned int i=0; i<mSquaresActorList.size(); i++) {
mSquaresActorList[i]->GetProperty()->SetColor(r,g,b);
+ mSquaresActorList[i]->GetProperty()->SetOpacity(0.995);
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void vvImageContour::SetLineWidth(double w)
-{
+{ //out << __func__ << endl;
for(unsigned int i=0; i<mSquaresActorList.size(); i++) {
mSquaresActorList[i]->GetProperty()->SetLineWidth(w);
}
//------------------------------------------------------------------------------
-void vvImageContour::HideActors() {
+void vvImageContour::HideActors()
+{ //out << __func__ << endl;
if (!mSlicer) return;
mSlice = mSlicer->GetSlice();
for(unsigned int i=0; i<mSquaresActorList.size(); i++) {
//------------------------------------------------------------------------------
-void vvImageContour::ShowActors() {
+void vvImageContour::ShowActors()
+{ //out << __func__ << endl;
if (!mSlicer) return;
mSlice = mSlicer->GetSlice();
mTSlice = mSlicer->GetTSlice();
//------------------------------------------------------------------------------
void vvImageContour::SetDepth(double d)
-{
+{ //out << __func__ << endl;
mDepth = d;
// Move the actor to be visible
double position[3] = {0, 0, 0};
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
-void vvImageContour::Update(double value) {
+void vvImageContour::Update(double value)
+{ //out << __func__ << endl;
if (!mSlicer) return;
if (mPreviousValue == value) {
if (mPreviousSlice == mSlicer->GetSlice()) {
//------------------------------------------------------------------------------
-void vvImageContour::UpdateWithPreserveMemoryMode() {
+void vvImageContour::UpdateWithPreserveMemoryMode()
+{ //out << __func__ << endl;
// Only change actor visibility if tslice change
mPreviousTslice = mTSlice;
mTSlice = mSlicer->GetTSlice();
if (mPreviousTslice != mTSlice) {
if (mPreviousTslice != -1) mSquaresActorList[mPreviousTslice]->VisibilityOff();
}
-
+
mSlicer->Render();
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
-void vvImageContour::InitializeCacheMode() {
+void vvImageContour::InitializeCacheMode()
+{ //out << __func__ << endl;
clitkExceptionMacro("TODO : not implemented yet");
mPreviousSlice = mPreviousOrientation = 0;
int dim = mSlicer->GetImage()->GetNumberOfDimensions();
//------------------------------------------------------------------------------
-int vvImageContour::ComputeCurrentOrientation() {
+int vvImageContour::ComputeCurrentOrientation()
+{ //out << __func__ << endl;
// Get extent of image in the slicer
int* extent = mSlicer->GetImageActor()->GetDisplayExtent();
//------------------------------------------------------------------------------
-void vvImageContour::UpdateWithFastCacheMode() {
+void vvImageContour::UpdateWithFastCacheMode()
+{ //out << __func__ << endl;
clitkExceptionMacro("TODO : not implemented yet");
// Compute orientation
//------------------------------------------------------------------------------
-void vvImageContour::CreateNewActor(int numImage) {
+void vvImageContour::CreateNewActor(int numImage)
+{ //out << __func__ << endl;
vtkSmartPointer<vtkActor> squaresActor = vtkSmartPointer<vtkActor>::New();
vtkSmartPointer<vtkImageClip> clipper = vtkSmartPointer<vtkImageClip>::New();
vtkSmartPointer<vtkMarchingSquares> squares = vtkSmartPointer<vtkMarchingSquares>::New();
clipper->SetInputData(mSlicer->GetImage()->GetVTKImages()[numImage]);
#endif
}
-
#if VTK_MAJOR_VERSION <= 5
squares->SetInput(clipper->GetOutput());
squaresMapper->SetInput(squares->GetOutput());
#else
- squares->SetInputData(clipper->GetOutput());
- squaresMapper->SetInputData(squares->GetOutput());
+ squares->SetInputConnection(clipper->GetOutputPort(0));
+ squaresMapper->SetInputConnection(squares->GetOutputPort(0));
#endif
squaresMapper->ScalarVisibilityOff();
squaresActor->SetMapper(squaresMapper);
squaresActor->GetProperty()->SetColor(1.0,0,0);
+ squaresActor->GetProperty()->SetOpacity(0.995);
squaresActor->SetPickable(0);
squaresActor->VisibilityOff();
mSlicer->GetRenderer()->AddActor(squaresActor);
vtkPolyDataMapper * mapper,
vtkMarchingSquares * squares,
vtkImageClip * clipper,
- double threshold, int orientation, int slice) {
+ double threshold, int orientation, int slice)
+{ //out << __func__ << endl;
// Set parameter for the MarchigSquare
squares->SetValue(0, threshold);
-
+ squares->Update();
// Get image extent
int* extent = mSlicer->GetImageActor()->GetDisplayExtent();
extent2 = extent;
actor->VisibilityOn();
}
-
+
clipper->SetOutputWholeExtent(extent2[0],extent2[1],extent2[2],
extent2[3],extent2[4],extent2[5]);
-
+
if (mHiddenImageIsUsed) delete extent2;
// Move the actor to be visible
// DD(mDepth);
// position[orientation] = -mDepth;
// actor->SetPosition(position);
-
mapper->Update();
}
//------------------------------------------------------------------------------
//====================================================================
vvLandmarksPanel::vvLandmarksPanel(QWidget * parent):QWidget(parent)
-{
+{ //out << __func__ << endl;
setupUi(this);
tableWidget->verticalHeader()->hide();
}
void vvLandmarksPanel::Load()
-{
+{ //out << __func__ << endl;
QString file = QFileDialog::getOpenFileName(this,tr("Load Landmarks"),
mCurrentPath.c_str(),tr("Landmarks ( *.txt *.pts)"));
if (!file.isEmpty()) {
}
bool vvLandmarksPanel::LoadFromFile(std::vector<std::string> files)
-{
+{ //out << __func__ << endl;
if (!mCurrentLandmarks->LoadFile(files))
return false;
- SetCurrentLandmarks(mCurrentLandmarks,2);
+ SetCurrentLandmarks(mCurrentLandmarks,0);
emit UpdateRenderWindows();
return true;
}
void vvLandmarksPanel::Save()
-{
+{ //out << __func__ << endl;
QString file = QFileDialog::getSaveFileName(this,
tr("Save Landmarks"),
mCurrentPath.c_str(),tr("Landmarks ( *.txt)"));
}
void vvLandmarksPanel::SelectPoint()
-{
+{ //out << __func__ << endl;
if (tableWidget->rowCount() > 0) {
QList<QTableWidgetItem *> items = tableWidget->selectedItems();
if (!items.empty()) {
void vvLandmarksPanel::RemoveSelectedPoints()
-{
+{ //out << __func__ << endl;
if (tableWidget->rowCount() > 0) {
QList<QTableWidgetItem *> items = tableWidget->selectedItems();
if (items.empty()) {
}
void vvLandmarksPanel::RemoveAllPoints()
-{
+{ //out << __func__ << endl;
mCurrentLandmarks->RemoveAll();
tableWidget->clearContents();
tableWidget->setRowCount(0);
}
void vvLandmarksPanel::AddPoint()
-{
+{ //out << __func__ << endl;
AddPoint(mCurrentLandmarks->GetNumberOfPoints()-1);
}
void vvLandmarksPanel::AddPoint(int landmarksIndex)
-{
+{ //out << __func__ << endl;
int rowIndex = tableWidget->rowCount();
// DD(rowIndex);
tableWidget->setRowCount(rowIndex+1);
}
void vvLandmarksPanel::SetCurrentLandmarks(vvLandmarks* lm,int time)
-{
+{ //out << __func__ << endl;
if (time != lm->GetTime())
return;
-
loadButton->setEnabled(1);
saveButton->setEnabled(1);
removeButton->setEnabled(1);
}
void vvLandmarksPanel::SetCurrentImage(std::string filename)
-{
+{ //out << __func__ << endl;
QString image = "<b>CurrentImage : </b>";
image += vtksys::SystemTools::GetFilenameWithoutLastExtension(filename).c_str();
nameLabel->setText(image);
}
void vvLandmarksPanel::CommentsChanged(int row, int column)
-{
+{ //out << __func__ << endl;
if (column == 6) {
mCurrentLandmarks->ChangeComments(row,std::string(tableWidget->item(row,column)->text().toStdString()));
tableWidget->resizeColumnsToContents();
#if VTK_MAJOR_VERSION <= 5
writer->SetInput(windowToImageFilter->GetOutput());
#else
- writer->SetInputData(windowToImageFilter->GetOutput());
+ writer->SetInputConnection(windowToImageFilter->GetOutputPort());
#endif
writer->Write();
}
#if VTK_MAJOR_VERSION <= 5
imgwriter->SetInput(image);
#else
- imgwriter->SetInputData(image);
+ imgwriter->SetInputConnection(w2i->GetOutputPort());
#endif
imgwriter->SetFileName(fileName.toStdString().c_str());
imgwriter->Write();
#if VTK_MAJOR_VERSION <= 5
vidwriter->SetInput(image);
#else
- vidwriter->SetInputData(image);
+ vidwriter->SetInputConnection(w2i->GetOutputPort());
#endif
vidwriter->SetFileName(fileName.toStdString().c_str());
vidwriter->Start();
#if VTK_MAJOR_VERSION <= 5
vidwriter->SetInput(w2i->GetOutput());
#else
- vidwriter->SetInputData(w2i->GetOutput());
+ vidwriter->SetInputConnection(w2i->GetOutputPort());
#endif
vidwriter->Write();
}
QTreeWidgetItem * item=DataTree->topLevelItem(DataTree->topLevelItemCount()-1);
CurrentImageChanged(mSlicerManagers.back()->GetId()); //select new image
item->setData(1,Qt::CheckStateRole,2); //show the new image in the first panel
+ //mSlicerManagers[GetSlicerIndexFromItem(item)]->GetSlicer(0)->SetActorVisibility("image", 0, 1); //Set the Last Image visibles
DisplayChanged(item,1);
}
}
connect(mSlicerManagers.back(), SIGNAL(LandmarkAdded()),landmarksPanel,SLOT(AddPoint()));
+
+ InitSlicers();
UpdateTree();
qApp->processEvents();
- InitSlicers();
- ShowLastImage();
InitDisplay();
+ ShowLastImage();
qApp->processEvents();
-
// End
ImageInfoChanged();
return slicer_manager;
#if VTK_MAJOR_VERSION <= 5
sts->SetInput(extrude->GetOutput());
#else
- sts->SetInputData(extrude->GetOutput());
+ sts->SetInputConnection(extrude->GetOutputPort());
#endif
} else {
#if VTK_MAJOR_VERSION <= 5
#if VTK_MAJOR_VERSION <= 5
mMapper->SetInput(mMarching->GetOutput());
#else
- mMapper->SetInputData(mMarching->GetOutput());
+ mMapper->SetInputConnection(mMarching->GetOutputPort());
#endif
//The following line allows to display the contour over the image
//(http://www.nabble.com/What-happens-when-two-actors-are-at-the-same-depth--td23175458.html)
//------------------------------------------------------------------------------
vvROIActor::vvROIActor()
-{
+{ //out << __func__ << endl;
mIsVisible = true;
mIsContourVisible = false;
mOpacity = 0.5;
//------------------------------------------------------------------------------
vvROIActor::~vvROIActor()
-{
+{ //out << __func__ << endl;
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void vvROIActor::RemoveActors()
-{
+{ //out << __func__ << endl;
for(unsigned int i= 0; i<mOverlayActors.size(); i++) {
mOverlayActors[i]->RemoveActors();
}
//------------------------------------------------------------------------------
void vvROIActor::SetROI(clitk::DicomRT_ROI * s)
-{
+{ //out << __func__ << endl;
mROI = s;
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
-void vvROIActor::SetContourWidth(int n) {
+void vvROIActor::SetContourWidth(int n)
+{ //out << __func__ << endl;
mContourWidth = n;
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
-void vvROIActor::SetSlicerManager(vvSlicerManager * s) {
+void vvROIActor::SetSlicerManager(vvSlicerManager * s)
+{ //out << __func__ << endl;
mSlicerManager = s;
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void vvROIActor::UpdateImage()
-{
+{ //out << __func__ << endl;
mOverlayActors.clear();
mImageContour.clear();
Initialize(mDepth, mIsVisible);
//------------------------------------------------------------------------------
void vvROIActor::SetVisible(bool b)
-{
+{ //out << __func__ << endl;
mIsVisible = b;
if (!b) { // remove actor
for(unsigned int i= 0; i<mOverlayActors.size(); i++)
//------------------------------------------------------------------------------
-void vvROIActor::SetContourVisible(bool b) {
+void vvROIActor::SetContourVisible(bool b)
+{ //out << __func__ << endl;
mIsContourVisible = b;
if (!b) { // remove actor
for(unsigned int i= 0; i<mImageContour.size(); i++) {
//------------------------------------------------------------------------------
-bool vvROIActor::IsVisible() {
+bool vvROIActor::IsVisible()
+{ //out << __func__ << endl;
return mIsVisible;
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
-bool vvROIActor::IsContourVisible() {
+bool vvROIActor::IsContourVisible()
+{ //out << __func__ << endl;
return mIsContourVisible;
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
-void vvROIActor::Initialize(double depth, bool IsVisible) {
+void vvROIActor::Initialize(double depth, bool IsVisible)
+{ //out << __func__ << endl;
if (mROI->GetImage()) {
mImageContour.clear();
mOverlayActors.clear();
mImageContour[i]->SetLineWidth(mContourWidth);
mImageContour[i]->SetPreserveMemoryModeEnabled(true);
mImageContour[i]->SetDepth(mDepth+0.5);
- mImageContour[i]->HideActors();
+ mImageContour[i]->ShowActors();
mOverlayActors.push_back(vvBinaryImageOverlayActor::New());
mOverlayActors[i]->Initialize(IsVisible);
mOverlayActors[i]->SetDepth(mDepth);
}
-
connect(mSlicerManager,SIGNAL(UpdateSlice(int,int)),this,SLOT(UpdateSlice(int, int)));
//connect(mSlicerManager,SIGNAL(UpdateTSlice(int,int)),this,SLOT(UpdateSlice(int, int)));
connect(mSlicerManager, SIGNAL(AVerticalSliderHasChanged(int, int)), SLOT(UpdateSlice(int, int)));
//------------------------------------------------------------------------------
void vvROIActor::SetDepth(double d)
-{
+{ //out << __func__ << endl;
mDepth = d;
if (!mSlicerManager) return;
for(int i=0; i<mSlicerManager->GetNumberOfSlicers(); i++) {
//------------------------------------------------------------------------------
void vvROIActor::Update(bool force)
-{
+{ //out << __func__ << endl;
if (!mSlicerManager) return;
for(int i=0; i<mSlicerManager->GetNumberOfSlicers(); i++) {
UpdateSlice(i, mSlicerManager->GetSlicer(i)->GetSlice(), force);
//------------------------------------------------------------------------------
void vvROIActor::UpdateSlice(int slicer, int slices, bool force)
-{
+{ //out << __func__ << endl;
if (!mROI->GetImage()) return;
if ((!mIsVisible) && (!mIsContourVisible)) return;
if (!mSlicerManager) {
//------------------------------------------------------------------------------
void vvROIActor::SetOpacity(double d)
-{
+{ //out << __func__ << endl;
mOpacity = d;
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
-void vvROIActor::SetContourColor(double r, double v, double b) {
+void vvROIActor::SetContourColor(double r, double v, double b)
+{ //out << __func__ << endl;
mContourColor[0] = r;
mContourColor[1] = v;
mContourColor[2] = b;
//------------------------------------------------------------------------------
-void vvROIActor::SetOverlayColor(double r, double v, double b) {
+void vvROIActor::SetOverlayColor(double r, double v, double b)
+{ //out << __func__ << endl;
if (mROI)
mROI->SetDisplayColor(r,v,b);
}
//------------------------------------------------------------------------------
-std::vector<double> & vvROIActor::GetContourColor() {
+std::vector<double> & vvROIActor::GetContourColor()
+{ //out << __func__ << endl;
return mContourColor;
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
-std::vector<double> & vvROIActor::GetOverlayColor() {
+std::vector<double> & vvROIActor::GetOverlayColor()
+{ //out << __func__ << endl;
return mROI->GetDisplayColor();
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
-void vvROIActor::UpdateColor() {
+void vvROIActor::UpdateColor()
+{ //out << __func__ << endl;
for(unsigned int i=0; i<mOverlayActors.size(); i++) {
mOverlayActors[i]->SetOpacity(mOpacity);
mOverlayActors[i]->SetColor(mROI->GetDisplayColor()[0],
//------------------------------------------------------------------------------
double vvROIActor::GetOpacity()
-{
+{ //out << __func__ << endl;
return mOpacity;
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void vvROIActor::SetSelected(bool b)
-{
+{ //out << __func__ << endl;
mIsSelected = b;
if (b) {
for(int i=0; i<mSlicerManager->GetNumberOfSlicers(); i++) {
//------------------------------------------------------------------------------
void vvROIActor::CopyParameters(QSharedPointer<vvROIActor> roi)
-{
+{ //out << __func__ << endl;
// Overlay
SetVisible(roi->IsVisible());
SetOpacity(roi->GetOpacity());
#if VTK_MAJOR_VERSION <= 5
pdm->SetInput(crossCursor->GetOutput());
#else
- pdm->SetInputData(crossCursor->GetOutput());
+ pdm->SetInputConnection(crossCursor->GetOutputPort(0));
#endif
pdmA = vtkSmartPointer<vtkActor2D>::New();
#else
mOverlayReslice->SetInputData(0, mOverlay->GetFirstVTKImageData());
#endif
- mImageReslice->UpdateInformation();
mOverlayReslice->Update();
if (!mOverlayMapper)
#if VTK_MAJOR_VERSION <= 5
mOverlayMapper->SetInput(mOverlayReslice->GetOutput());
#else
- mOverlayMapper->SetInputData(mOverlayReslice->GetOutput());
+ mOverlayMapper->SetInputConnection(mOverlayReslice->GetOutputPort(0));
#endif
if (!mOverlayActor) {
#if VTK_MAJOR_VERSION <= 5
mFusionMapper->SetInput(mFusionReslice->GetOutput());
#else
- mFusionMapper->SetInputData(mFusionReslice->GetOutput());
+ mFusionMapper->SetInputConnection(mFusionReslice->GetOutputPort(0));
#endif
if (!mFusionActor) {
mAAFilter->SetInput(mVOIFilter->GetOutput());
#else
mVOIFilter->SetInputData(vf->GetFirstVTKImageData());
- mAAFilter->SetInputData(mVOIFilter->GetOutput());
+ mAAFilter->SetInputConnection(mVOIFilter->GetOutputPort());
#endif
///This tells VTK to use the scalar (pixel) data of the image to draw the little arrows
mAAFilter->Assign(vtkDataSetAttributes::SCALARS, vtkDataSetAttributes::VECTORS, vtkAssignAttribute::POINT_DATA);
mGlyphFilter->SetInput(mAAFilter->GetOutput());
mGlyphFilter->SetSource(mArrow->GetOutput());
#else
- mGlyphFilter->SetInputData(mAAFilter->GetOutput());
- mGlyphFilter->SetSourceData(mArrow->GetOutput());
+ mGlyphFilter->SetInputConnection(mAAFilter->GetOutputPort());
+ mGlyphFilter->SetSourceConnection(mArrow->GetOutputPort());
#endif
mGlyphFilter->ScalingOn();
mGlyphFilter->SetScaleModeToScaleByVector();
#if VTK_MAJOR_VERSION <= 5
mVFMapper->SetInput(mGlyphFilter->GetOutput());
#else
- mVFMapper->SetInputData(mGlyphFilter->GetOutput());
+ mVFMapper->SetInputConnection(mGlyphFilter->GetOutputPort());
#endif
mVFMapper->ImmediateModeRenderingOn();
mVFMapper->SetLookupTable(mVFColorLUT);
#else
mLandClipper->SetInputData(mLandmarks->GetOutput());
- mLandGlyph->SetSourceData(mCross->GetOutput());
- mLandGlyph->SetInputData(mLandClipper->GetOutput());
+ mLandGlyph->SetSourceConnection(mCross->GetOutputPort());
+ mLandGlyph->SetInputConnection(mLandClipper->GetOutputPort());
#endif
//mLandGlyph->SetIndexModeToScalar();
//mLandGlyph->SetRange(0,1);
//mLandMapper->ScalarVisibilityOff();
mLandActor->SetMapper(mLandMapper);
+ mLandActor->GetProperty()->SetOpacity(0.995);
mLandActor->GetProperty()->SetColor(255,10,212);
mLandActor->SetPickable(0);
mLandActor->SetVisibility(true);
#else
mOverlayReslice->SetInputData( mOverlay->GetVTKImages()[mCurrentOverlayTSlice] );
#endif
-
// Update overlay transform
mConcatenatedOverlayTransform->Identity();
mConcatenatedOverlayTransform->Concatenate(mOverlay->GetTransform()[mCurrentOverlayTSlice]);
//----------------------------------------------------------------------------
void vvSlicer::UpdateDisplayExtent()
-{ cout << __func__ << endl;
+{ //out << __func__ << endl;
vtkImageData *input = this->GetInput();
if (!input || !this->ImageActor) {
// Image actor
this->ImageActor->SetVisibility(mImageVisibility);
-#if VTK_MAJOR_VERSION <= 5
this->ImageActor->SetDisplayExtent(w_ext);
-#else
+#if VTK_MAJOR_VERSION >= 6
+//mSlicingTransform->Print(cout);
+//GetImage()->GetTransform()[0]->Print(cout);
+//mSlicingTransform = GetImage()->GetTransform()[0];
+//mImageReslice->SetResliceTransform(mSlicingTransform);
+//mImageReslice->AutoCropOutputOff();
+//mImageReslice->Update();
+int* extentTest = mImageReslice->GetOutput()->GetExtent();
+cout<< extentTest[0] << " " << extentTest[1] << " " << extentTest[2] << " " << extentTest[3] << " " << extentTest[4] << " " << extentTest[5] << endl;
+//this->GetInput()->Print(cout);
+//GetImageActor()->GetMapper()->Print(cout);
vtkSmartPointer<vtkOpenGLImageSliceMapper> mapperOpenGL= vtkSmartPointer<vtkOpenGLImageSliceMapper>::New();
try {
mapperOpenGL = dynamic_cast<vtkOpenGLImageSliceMapper*>(GetImageActor()->GetMapper());
}
if (mFirstSetSliceOrientation) {
copyExtent(ext, mRegisterExtent);
- this->ImageActor->SetDisplayExtent(w_ext); //initialisation
} else {
int w_croppingRegion[6];
- copyExtent(mRegisterExtent, w_croppingRegion);
- this->ImageActor->SetDisplayExtent(w_ext);
+ if (mUseReducedExtent) {
+ copyExtent(extentTest, w_croppingRegion);
+ } else {
+ copyExtent(extentTest, w_croppingRegion);
+ }
+ cout << "w_ext : " << w_ext[0] << " " << w_ext[1] << " " << w_ext[2] << " " << w_ext[3] << " " << w_ext[4] << " " << w_ext[5] << endl;
w_croppingRegion[ this->SliceOrientation*2 ] = this->Slice;
w_croppingRegion[ this->SliceOrientation*2+1 ] = this->Slice;
mapperOpenGL->SetCroppingRegion(w_croppingRegion);
+ cout << "w_croppingRegion : " << w_croppingRegion[0] << " " << w_croppingRegion[1] << " " << w_croppingRegion[2] << " " << w_croppingRegion[3] << " " << w_croppingRegion[4] << " " << w_croppingRegion[5] << endl;
}
#endif
#if VTK_MAJOR_VERSION <= 5
bool out = ClipDisplayedExtent(overExtent, mOverlayMapper->GetInput()->GetWholeExtent());
#else
- bool out = ClipDisplayedExtent(overExtent, mOverlayMapper->GetInput()->GetInformation()->Get(vtkDataObject::DATA_EXTENT()));
+ bool out = ClipDisplayedExtent(overExtent, mImage->GetVTKImages()[mCurrentTSlice]->GetInformation()->Get(vtkDataObject::DATA_EXTENT()));
#endif
mOverlayActor->SetVisibility(!out);
mOverlayActor->SetDisplayExtent( overExtent );
#if VTK_MAJOR_VERSION <= 5
bool out = ClipDisplayedExtent(fusExtent, mFusionMapper->GetInput()->GetWholeExtent());
#else
- bool out = ClipDisplayedExtent(fusExtent, mFusionMapper->GetInput()->GetInformation()->Get(vtkDataObject::DATA_EXTENT()));
+ bool out = ClipDisplayedExtent(fusExtent, mImage->GetVTKImages()[mCurrentTSlice]->GetInformation()->Get(vtkDataObject::DATA_EXTENT()));
#endif
mFusionActor->SetVisibility(!out);
mFusionActor->SetDisplayExtent( fusExtent );
#if VTK_MAJOR_VERSION <= 5
bool out = ClipDisplayedExtent(vfExtent, mVOIFilter->GetInput()->GetWholeExtent());
#else
- bool out = ClipDisplayedExtent(vfExtent, mVOIFilter->GetInput()->GetInformation()->Get(vtkDataObject::DATA_EXTENT()));
+ bool out = ClipDisplayedExtent(vfExtent, mImage->GetVTKImages()[mCurrentTSlice]->GetInformation()->Get(vtkDataObject::DATA_EXTENT()));
#endif
mVFActor->SetVisibility(!out);
mVOIFilter->SetVOI(vfExtent);
int orientation[3] = {1,1,1};
orientation[this->SliceOrientation] = 0;
mGlyphFilter->SetOrientation(orientation[0], orientation[1], orientation[2]);
- mVFMapper->Update();
-
position[this->SliceOrientation] += offset;
mVFActor->SetPosition(position);
+ mVFActor->GetProperty()->SetOpacity(0.995);
+ mVFMapper->Update();
+
}
else if(mVF)
mVFActor->SetVisibility(false);
#if VTK_MAJOR_VERSION <= 5
accFilter->SetInput(voiFilter->GetOutput());
#else
- accFilter->SetInputData(voiFilter->GetOutput());
+ accFilter->SetInputConnection(voiFilter->GetOutputPort(0));
#endif
accFilter->Update();
//----------------------------------------------------------------------------
void vvSlicer::Render()
-{ cout << __func__ << endl;
+{ //out << __func__ << endl;
if (this->mFusion && mFusionActor->GetVisibility() && showFusionLegend) {
legend->SetLookupTable(this->GetFusionMapper()->GetLookupTable());
legend->UseOpacityOn();
#else
mOverlayMapper->SetUpdateExtent(mOverlayActor->GetDisplayExtent());
#endif
- mOverlayActor->Print(cout);
mOverlayMapper->Update();
}
if (mFusion && mFusionActor->GetVisibility()) {
if (mLandMapper)
UpdateLandmarks();
- this->GetRenderWindow()->Render();
+ this->GetRenderWindow()->Render();
}
//----------------------------------------------------------------------------
double* GetCursorPosition() {
return mCursor;
}
-
vtkTransform * GetSlicingTransform() { return mSlicingTransform; }
vtkTransform * GetConcatenatedTransform() { return mConcatenatedTransform; }
vtkTransform * GetConcatenatedFusionTransform() { return mConcatenatedFusionTransform; }
y_index <= extentImageReslice[3]+0.5 &&\r
z_index >= extentImageReslice[4]-0.5 &&\r
z_index <= extentImageReslice[5]+0.5) {\r
- double value = this->GetScalarComponentAsDouble(mSlicers[0]->GetInput(), x_index, y_index, z_index);\r
+ double value = this->GetScalarComponentAsDouble(mImage->GetVTKImages()[mSlicers[0]->GetTSlice()], x_index, y_index, z_index);\r
this->GetLandmarks()->AddLandmark(x,y,z,t,value);\r
emit LandmarkAdded();\r
}\r
#if VTK_MAJOR_VERSION <= 5
mMapper->SetInput(mReaders[mCurrentTime]->GetOutput());
#else
- mMapper->SetInputData(mReaders[mCurrentTime]->GetOutput());
+ mMapper->SetInputConnection(mReaders[mCurrentTime]->GetOutputPort());
#endif
if (!mActor) {
#if VTK_MAJOR_VERSION <= 5
mMapper->SetInput(mReaders[mCurrentTime]->GetOutput());
#else
- mMapper->SetInputData(mReaders[mCurrentTime]->GetOutput());
+ mMapper->SetInputConnection(mReaders[mCurrentTime]->GetOutputPort());
#endif
mMapper->Modified();
renderWidget->GetRenderWindow()->Render();
#if VTK_MAJOR_VERSION <= 5
mMapper->SetInput(mReaders[mCurrentTime]->GetOutput());
#else
- mMapper->SetInputData(mReaders[mCurrentTime]->GetOutput());
+ mMapper->SetInputConnection(mReaders[mCurrentTime]->GetOutputPort());
#endif
mMapper->Modified();
renderWidget->GetRenderWindow()->Render();
#include <vtkImageClip.h>
#include <vtkRenderWindow.h>
+
//------------------------------------------------------------------------------
// Create the tool and automagically (I like this word) insert it in
// the main window menu.
//------------------------------------------------------------------------------
void vvToolBinarize::Initialize()
-{
+{ //out << __func__ << endl;
SetToolName("Binarize");
SetToolMenuName("Binarize");
SetToolIconFilename(":/common/icons/binarize.png");
:vvToolWidgetBase(parent,f),
vvToolBase<vvToolBinarize>(parent),
Ui::vvToolBinarize()
-{
+{ //out << __func__ << endl;
// GUI Initialization
Ui_vvToolBinarize::setupUi(mToolWidget);
mInteractiveDisplayIsEnabled = mCheckBoxInteractiveDisplay->isChecked();
//------------------------------------------------------------------------------
vvToolBinarize::~vvToolBinarize()
-{
+{ //out << __func__ << endl;
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void vvToolBinarize::InteractiveDisplayToggled(bool b)
-{
+{ //out << __func__ << endl;
mInteractiveDisplayIsEnabled = b;
if (!mInteractiveDisplayIsEnabled) {
RemoveVTKObjects();
//------------------------------------------------------------------------------
void vvToolBinarize::RemoveVTKObjects()
-{
+{ //out << __func__ << endl;
for(unsigned int i=0; i<mImageContour.size(); i++) {
mImageContour[i]->HideActors();
mImageContourLower[i]->HideActors();
//------------------------------------------------------------------------------
bool vvToolBinarize::close()
-{
+{ //out << __func__ << endl;
// RemoveVTKObjects();
return vvToolWidgetBase::close();
}
//------------------------------------------------------------------------------
-void vvToolBinarize::closeEvent(QCloseEvent *event) {
+void vvToolBinarize::closeEvent(QCloseEvent *event)
+{ //out << __func__ << endl;
RemoveVTKObjects();
event->accept();
}
//------------------------------------------------------------------------------
void vvToolBinarize::reject()
-{
+{ //out << __func__ << endl;
// DD("vvToolBinarize::reject");
RemoveVTKObjects();
return vvToolWidgetBase::reject();
//------------------------------------------------------------------------------
void vvToolBinarize::enableLowerThan(bool b)
-{
+{ //out << __func__ << endl;
if (!b) {
mThresholdSlider1->resetMaximum();
for(unsigned int i=0; i<mImageContour.size(); i++) {
//------------------------------------------------------------------------------
void vvToolBinarize::useFGBGtoggled(bool)
-{
+{ //out << __func__ << endl;
if (!mCheckBoxUseBG->isChecked() && !mCheckBoxUseFG->isChecked())
mCheckBoxUseBG->toggle();
}
// DD(m.size());
// }
void vvToolBinarize::InputIsSelected(vvSlicerManager * m)
-{
+{ //out << __func__ << endl;
mCurrentSlicerManager = m;
// Specific for this gui
mImageContour.push_back(vvImageContour::New());
mImageContour[i]->SetSlicer(mCurrentSlicerManager->GetSlicer(i));
mImageContour[i]->SetColor(1.0, 0.0, 0.0);
- mImageContour[i]->SetDepth(100); // to be in front of (whe used with ROI tool)
+ mImageContour[i]->SetDepth(0); // to be in front of (whe used with ROI tool)
mImageContourLower.push_back(vvImageContour::New());
mImageContourLower[i]->SetSlicer(mCurrentSlicerManager->GetSlicer(i));
mImageContourLower[i]->SetColor(0.0, 0.0, 1.0);
connect(mCurrentSlicerManager,SIGNAL(UpdateOrientation(int,int)),this,SLOT(UpdateOrientation(int, int)));
// connect(mCurrentSlicerManager, SIGNAL(LeftButtonReleaseSignal(int)), SLOT(LeftButtonReleaseEvent(int)));
-
InteractiveDisplayToggled(mInteractiveDisplayIsEnabled);
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void vvToolBinarize::UpdateOrientation(int slicer,int orientation)
-{
+{ //out << __func__ << endl;
Update(slicer);
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void vvToolBinarize::UpdateSlice(int slicer,int slices)
-{
+{ //out << __func__ << endl;
Update(slicer);
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void vvToolBinarize::Update(int slicer)
-{
+{ //out << __func__ << endl;
if (!mInteractiveDisplayIsEnabled) return;
if (!mCurrentSlicerManager) close();
mImageContour[slicer]->Update(mThresholdSlider1->GetValue());
//------------------------------------------------------------------------------
void vvToolBinarize::GetArgsInfoFromGUI()
-{
+{ //out << __func__ << endl;
/* //KEEP THIS FOR READING GGO FROM FILE
int argc=1;
//------------------------------------------------------------------------------
void vvToolBinarize::apply()
-{
+{ //out << __func__ << endl;
if (!mCurrentSlicerManager) close();
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
- GetArgsInfoFromGUI();
-
+ GetArgsInfoFromGUI();
+
// Main filter
clitk::BinarizeImageGenericFilter::Pointer filter =
clitk::BinarizeImageGenericFilter::New();
filter->SetArgsInfo(mArgsInfo);
filter->Update();
+
// Output
- vvImage::Pointer output = filter->GetOutputVVImage();
+ vvImage::Pointer output = filter->GetOutputVVImage();
std::ostringstream osstream;
osstream << "Binarized_" << mCurrentSlicerManager->GetSlicer(0)->GetFileName() << ".mhd";
AddImage(output,osstream.str());
//------------------------------------------------------------------------------
void vvToolBinarize::valueChangedT2(double v)
-{
+{ //out << __func__ << endl;
// DD("valueChangedT2");
if (mRadioButtonLowerThan->isChecked()) {
mThresholdSlider1->SetMaximum(v);
//------------------------------------------------------------------------------
void vvToolBinarize::valueChangedT1(double v)
-{
+{ //out << __func__ << endl;
// DD("valueChangedT1");
if (!mCurrentSlicerManager) close();
mThresholdSlider2->SetMinimum(v);
{
if(mCurrentSlicerManager){
// Reset extends
- for(int i=0; i<mExtentSize; i++){
+ for(int i=0; i<6; i++){
mReducedExtent[i] = mInitialExtent[i];
}
UpdateExtent();
}
// Set initial sliders values
- std::vector<int> imsize = mCurrentSlicerManager->GetImage()->GetSize();
+ int w_ext[6], imsize[3];
+ mCurrentSlicerManager->GetSlicer(0)->GetRegisterExtent(w_ext);
for(int dim=0; dim<slicer->GetDimension() && dim<3; ++dim){
+ imsize[dim] = w_ext[2*dim+1] - w_ext[2*dim] +1;
mSliders[dim*2]->setMaximum(imsize[dim]-1);
mSliders[dim*2+1]->setMaximum(imsize[dim]-1);
mSliders[dim*2+1]->setValue(imsize[dim]-1);
#include "vvImageWriter.h"
#include "vvROIActor.h"
#include "vvSlicer.h"
-#include "vvROIActor.h"
#include "vvMeshReader.h"
#include "vvStructSelector.h"
#include "vvToolManager.h"
QWidget(parent->GetTab()),
vvToolBase<vvToolROIManager>(parent),
Ui::vvToolROIManager()
-{
+{ //out << __func__ << endl;
// Store parent
mMainWindow = parent;
//------------------------------------------------------------------------------
vvToolROIManager::~vvToolROIManager()
-{
+{ //out << __func__ << endl;
mROIActorsList.clear();
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// STATIC
-void vvToolROIManager::Initialize() {
+void vvToolROIManager::Initialize()
+{ //out << __func__ << endl;
SetToolName("ROIManager");
SetToolMenuName("Open ROI (binary image or RT-STRUCT)");
SetToolIconFilename(":/common/icons/tool-roi.png");
//------------------------------------------------------------------------------
void vvToolROIManager::InitializeNewTool(bool ReadStateFlag)
-{
+{ //out << __func__ << endl;
// Check if we need to start a new tool or read in the state file to load
if (ReadStateFlag == false) {
// Select the current image as the target
//------------------------------------------------------------------------------
void vvToolROIManager::InputIsSelected(vvSlicerManager *m)
-{
+{ //out << __func__ << endl;
// Initialization
mCurrentSlicerManager = m;
mCurrentImage = mCurrentSlicerManager->GetImage();
//------------------------------------------------------------------------------
void vvToolROIManager::AnImageIsBeingClosed(vvSlicerManager * m)
-{
+{ //out << __func__ << endl;
if (m == mCurrentSlicerManager) {
close();
return;
//------------------------------------------------------------------------------
void vvToolROIManager::close()
-{
+{ //out << __func__ << endl;
disconnect(mTree, SIGNAL(itemSelectionChanged()), this, SLOT(SelectedItemChangedInTree()));
disconnect(mCheckBoxShow, SIGNAL(toggled(bool)), this, SLOT(VisibleROIToggled(bool)));
disconnect(mOpacitySlider, SIGNAL(valueChanged(int)), this, SLOT(OpacityChanged(int)));
//------------------------------------------------------------------------------
-void vvToolROIManager::SelectedImageHasChanged(vvSlicerManager * m) {
-
+void vvToolROIManager::SelectedImageHasChanged(vvSlicerManager * m)
+{ //out << __func__ << endl;
if (mCurrentSlicerManager == NULL) return;
if (m == NULL) return;
if (m != mCurrentSlicerManager) hide();
//------------------------------------------------------------------------------
void vvToolROIManager::Open()
-{
+{ //out << __func__ << endl;
// Open images
QString Extensions = "Images or Dicom-Struct files ( *.mha *.mhd *.hdr *.his *.dcm RS*)";
Extensions += ";;All Files (*)";
//------------------------------------------------------------------------------
void vvToolROIManager::OpenBinaryImage(QStringList & filename)
-{
+{ //out << __func__ << endl;
if (filename.size() == 0) return;
vvProgressDialog p("Reading ROI ...", true);
//------------------------------------------------------------------------------
void vvToolROIManager::OpenDicomImage(std::string filename)
-{
+{ //out << __func__ << endl;
// GUI selector of roi
vvMeshReader reader;
reader.SetFilename(filename);
std::string name,
std::string filename,
double BG, bool modeBG)
-{
+{ //out << __func__ << endl;
// Check Dimension
int dim = mCurrentImage->GetNumberOfDimensions();
int bin_dim = binaryImage->GetNumberOfDimensions();
// CheckBox for "All"
if (actor->IsVisible()) mNumberOfVisibleROI++;
if (actor->IsContourVisible()) mNumberOfVisibleContourROI++;
-
+ AllVisibleContourROIToggled(true);
+
// Add ROI in tree
mTreeWidgetList.push_back(QSharedPointer<QTreeWidgetItem>(new QTreeWidgetItem(mTree)));
QTreeWidgetItem * w = mTreeWidgetList.back().data();
//------------------------------------------------------------------------------
void vvToolROIManager::UpdateAllContours()
-{
+{ //out << __func__ << endl;
if (mCurrentSlicerManager == NULL) return;
// Render loaded ROIs (the first is sufficient)
for(unsigned int i=0; i<mROIList.size(); i++) {
//------------------------------------------------------------------------------
-void vvToolROIManager::UpdateAllROIStatus() {
+void vvToolROIManager::UpdateAllROIStatus()
+{ //out << __func__ << endl;
int nbVisible = 0;
int nb = mROIList.size();
for(int i=0; i<nb; i++) {
//------------------------------------------------------------------------------
-void vvToolROIManager::SelectedItemChangedInTree() {
+void vvToolROIManager::SelectedItemChangedInTree()
+{ //out << __func__ << endl;
// Search which roi is selected
QList<QTreeWidgetItem *> l = mTree->selectedItems();
if (l.size() == 0) {
//------------------------------------------------------------------------------
-void vvToolROIManager::VisibleROIToggled(bool b) {
+void vvToolROIManager::VisibleROIToggled(bool b)
+{ //out << __func__ << endl;
if (mCurrentROIActor == NULL) return;
if (b == mCurrentROIActor->IsVisible()) return; // nothing to do
mCurrentROIActor->SetVisible(b);
//------------------------------------------------------------------------------
-void vvToolROIManager::VisibleContourROIToggled(bool b) {
+void vvToolROIManager::VisibleContourROIToggled(bool b)
+{ //out << __func__ << endl;
if (mCurrentROIActor == NULL) return;
if (mCurrentROIActor->IsContourVisible() == b) return; // nothing to do
mCurrentROIActor->SetContourVisible(b);
//------------------------------------------------------------------------------
-void vvToolROIManager::OpacityChanged(int v) {
+void vvToolROIManager::OpacityChanged(int v)
+{ //out << __func__ << endl;
if (mCurrentROIActor == NULL) return;
mCurrentROIActor->SetOpacity((double)v/100.0);
mCurrentROIActor->UpdateColor();
//------------------------------------------------------------------------------
-void vvToolROIManager::AllVisibleROIToggled(int b) {
+void vvToolROIManager::AllVisibleROIToggled(int b)
+{ //out << __func__ << endl;
bool status = false;
if ((mCheckBoxShowAll->checkState() == Qt::Checked) ||
(mCheckBoxShowAll->checkState() == Qt::PartiallyChecked)) status = true;
//------------------------------------------------------------------------------
-void vvToolROIManager::AllVisibleContourROIToggled(bool b) {
+void vvToolROIManager::AllVisibleContourROIToggled(bool b)
+{ //out << __func__ << endl;
bool status = false;
if ((mContourCheckBoxShowAll->checkState() == Qt::Checked) ||
(mContourCheckBoxShowAll->checkState() == Qt::PartiallyChecked)) status = true;
//------------------------------------------------------------------------------
-void vvToolROIManager::ChangeColor() {
+void vvToolROIManager::ChangeColor()
+{ //out << __func__ << endl;
if (mCurrentROIActor == NULL) return;
QColor color;
color.setRgbF(mCurrentROIActor->GetROI()->GetDisplayColor()[0],
//------------------------------------------------------------------------------
-void vvToolROIManager::ChangeContourColor() {
+void vvToolROIManager::ChangeContourColor()
+{ //out << __func__ << endl;
if (mCurrentROIActor == NULL) return;
QColor color;
color.setRgbF(mCurrentROIActor->GetContourColor()[0],
//------------------------------------------------------------------------------
-void vvToolROIManager::ChangeContourWidth(int n) {
+void vvToolROIManager::ChangeContourWidth(int n)
+{ //out << __func__ << endl;
if (mCurrentROIActor == NULL) return;
mCurrentROIActor->SetContourWidth(n);
mCurrentROIActor->UpdateColor();
//------------------------------------------------------------------------------
-void vvToolROIManager::ChangeDepth(int n) {
+void vvToolROIManager::ChangeDepth(int n)
+{ //out << __func__ << endl;
if (mCurrentROIActor == NULL) return;
mCurrentROIActor->SetDepth(n);
// mCurrentROIActor->UpdateImage(); // FIXME
//------------------------------------------------------------------------------
-void vvToolROIManager::ReloadCurrentROI() {
+void vvToolROIManager::ReloadCurrentROI()
+{ //out << __func__ << endl;
if (mCurrentROI->GetFilename() == "") {
return; // do nothing (contour from rt struct do not reload)
}
//------------------------------------------------------------------------------
void vvToolROIManager::SaveState(std::auto_ptr<QXmlStreamWriter> & m_XmlWriter)
-{
+{ //out << __func__ << endl;
// Get index of the image
int n = mMainWindow->GetSlicerManagers().size();
int index=-1;
//------------------------------------------------------------------------------
void vvToolROIManager::ReadXMLInformation()
-{
+{ //out << __func__ << endl;
std::string value="";
mInitialImageIndex = -1;
while (!(m_XmlReader->isEndElement() && value == GetToolName().toStdString())) {
//------------------------------------------------------------------------------
void vvToolROIManager::ReadXMLInformation_ROI()
-{
+{ //out << __func__ << endl;
QString s;
std::string value="";
QSharedPointer<vvROIActor> param = QSharedPointer<vvROIActor>(new vvROIActor);
vtkSmartPointer<vtkTransform> transform=vtkSmartPointer<vtkTransform>::New();
// TODO SR and BP: check on the list of transforms and not the first only
mCurrentSlicerManager->GetImage()->GetTransform()[0]->SetMatrix(matrix);
+ //mCurrentSlicerManager->GetSlicer(2)->GetSlicingTransform()->SetMatrix(matrix);
transform->Update();
Render();
dynamic_cast<vvMainWindow*>(mMainWindow)->ImageInfoChanged();
rotSliders[i]->setValue(iAngle);
rotSliders[i]->blockSignals(false);
}
- }
+ }cout << euler->GetParameters()[0+3] << " " << euler->GetParameters()[1+3] << " " << euler->GetParameters()[2+3] << endl;
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void vvToolRigidReg::Render()
{ //out << __func__ << endl;
-#if VTK_MAJOR_VERSION > 5
+#if VTK_MAJOR_VERSION > 7
double translationValues[4], translationValuesUpdate[4];
mCurrentSlicerManager->GetImage()->GetTransform()[0]->Print(cout);
vtkMatrix4x4* matrix = mCurrentSlicerManager->GetImage()->GetTransform()[0]->GetMatrix();
#endif
for (int i=0; i<mCurrentSlicerManager->GetNumberOfSlicers(); i++) {
-#if VTK_MAJOR_VERSION > 5
+#if VTK_MAJOR_VERSION > 7
double pointExtent[8][4], pointExtentUpdate[8][4], pointOverlayExtent[8][4], pointOverlayExtentUpdate[8][4], centre[3], translation[3];
std::vector<int> w_ext;
w_ext=mCurrentSlicerManager->GetImage()->GetSize();
--- /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
+ ===========================================================================**/
+
+// vv
+#include "vvToolTest.h"
+#include "vvSlicerManager.h"
+#include "vvSlicer.h"
+#include "vvToolInputSelectorWidget.h"
+
+// clitk
+#include "clitkBinarizeImageGenericFilter.h"
+
+// vtk
+#include <vtkImageActor.h>
+#include <vtkCamera.h>
+#include <vtkImageClip.h>
+#include <vtkRenderWindow.h>
+#include <vtkPolyDataMapper.h>
+#include <vtkRenderer.h>
+#include <vtkSphereSource.h>
+#include <vtkProperty.h>
+
+
+//------------------------------------------------------------------------------
+// Create the tool and automagically (I like this word) insert it in
+// the main window menu.
+ADD_TOOL(vvToolTest);
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+void vvToolTest::Initialize()
+{ cout << __func__ << endl;
+ SetToolName("Test");
+ SetToolMenuName("Test");
+ SetToolIconFilename(":/common/icons/binarize.png");
+ SetToolTip("try to display a sphere.");
+}
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+vvToolTest::vvToolTest(vvMainWindowBase * parent, Qt::WindowFlags f)
+ :vvToolWidgetBase(parent,f),
+ vvToolBase<vvToolTest>(parent),
+ Ui::vvToolTest()
+{ cout << __func__ << endl;
+ // GUI Initialization
+
+ // Connect signals & slots
+
+ // Main filter
+ mFilter = clitk::BinarizeImageGenericFilter::New();
+
+ // Set how many inputs are needed for this tool
+ AddInputSelector("Select one image", mFilter);
+}
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+vvToolTest::~vvToolTest()
+{ cout << __func__ << endl;
+}
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+/*
+void vvToolTest::InteractiveDisplayToggled(bool b)
+{ cout << __func__ << endl;
+ mInteractiveDisplayIsEnabled = b;
+ if (!mInteractiveDisplayIsEnabled) {
+ RemoveVTKObjects();
+ } else {
+ for(unsigned int i=0; i<mImageContour.size(); i++) {
+ mImageContour[i]->ShowActors();
+ if (mRadioButtonLowerThan->isChecked())
+ mImageContourLower[i]->ShowActors();
+ }
+ if (mCurrentSlicerManager)
+ mCurrentSlicerManager->Render();
+ }
+}
+*/
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+bool vvToolTest::close()
+{ cout << __func__ << endl;
+ return vvToolWidgetBase::close();
+}
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+void vvToolTest::reject()
+{ cout << __func__ << endl;
+ // DD("vvToolBinarize::reject");
+ return vvToolWidgetBase::reject();
+}
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+
+void vvToolTest::InputIsSelected(vvSlicerManager * m)
+{ cout << __func__ << endl;
+ mCurrentSlicerManager = m;
+
+
+ vtkSmartPointer<vtkSphereSource> sphereSource =
+ vtkSmartPointer<vtkSphereSource>::New();
+ sphereSource->SetCenter(0, 0, 0);
+ //sphereSource->SetCenter(235.351, 175.781, 141.0);
+ sphereSource->SetRadius(10.0);
+ sphereSource->Update();
+ vtkSmartPointer<vtkPolyDataMapper> sphereMapper =
+ vtkSmartPointer<vtkPolyDataMapper>::New();
+ sphereMapper->SetInputConnection(sphereSource->GetOutputPort());
+ vtkSmartPointer<vtkActor> sphereActor =
+ vtkSmartPointer<vtkActor>::New();
+ sphereActor->SetMapper(sphereMapper);
+ sphereActor->GetProperty()->SetColor(1.0, 0.0, 0.0);
+ sphereActor->GetProperty()->SetOpacity(0.995);
+ sphereActor->SetPosition(235.351, 175.781, -10);
+
+
+ // VTK Renderer
+ vtkSmartPointer<vtkRenderer> sphereRenderer =
+ vtkSmartPointer<vtkRenderer>::New();
+ // Add Actor to renderer
+ for(int i=0;i<mCurrentSlicerManager->GetNumberOfSlicers(); i++) {
+ mCurrentSlicerManager->GetSlicer(i)->GetRenderer()->AddActor(sphereActor);
+ }
+ //sphereRenderer->AddActor(sphereActor); //mettre le vvSlicer
+
+ // VTK/Qt wedded
+ //this->qvtkWidgetLeft->GetRenderWindow()->AddRenderer(leftRenderer);
+
+
+
+
+
+ // VTK objects for interactive display
+ valueChangedT1();
+
+ //connect(mThresholdSlider1, SIGNAL(valueChanged(double)), this, SLOT(valueChangedT1()));
+
+ connect(mCurrentSlicerManager,SIGNAL(UpdateSlice(int,int)),this,SLOT(UpdateSlice(int, int)));
+ connect(mCurrentSlicerManager,SIGNAL(UpdateTSlice(int,int)),this,SLOT(UpdateSlice(int, int)));
+
+ connect(mCurrentSlicerManager,SIGNAL(UpdateOrientation(int,int)),this,SLOT(UpdateSlice(int, int)));
+
+ // connect(mCurrentSlicerManager, SIGNAL(LeftButtonReleaseSignal(int)), SLOT(LeftButtonReleaseEvent(int)));
+ //InteractiveDisplayToggled(mInteractiveDisplayIsEnabled);
+}
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+// void vvToolBinarize::LeftButtonReleaseEvent(int slicer) {
+// DD("LeftButtonReleaseEvent");
+// for(int i=0; i<mCurrentSlicerManager->GetNumberOfSlicers(); i++) {
+// if (i == slicer);
+// mCurrentSlicerManager->GetSlicer(i)->GetRenderWindow()->Render();
+// }
+// }
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+void vvToolTest::apply()
+{ cout << __func__ << endl;
+ if (!mCurrentSlicerManager) close();
+ QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
+ //GetArgsInfoFromGUI();
+
+ // Main filter
+
+
+
+ // Output
+ QApplication::restoreOverrideCursor();
+ close();
+}
+//------------------------------------------------------------------------------
+
+//------------------------------------------------------------------------------
+void vvToolTest::UpdateSlice(int slicer,int slices)
+{ cout << __func__ << endl;
+ Update(slicer);
+}
+//------------------------------------------------------------------------------
+
+//------------------------------------------------------------------------------
+void vvToolTest::Update(int slicer)
+{ cout << __func__ << endl;
+ if (!mCurrentSlicerManager) close();
+ mCurrentSlicerManager->Render();
+ //mImageContour[slicer]->Update(mThresholdSlider1->GetValue());
+}
+//------------------------------------------------------------------------------
+
+//------------------------------------------------------------------------------
+/* void vvToolTest::GetArgsInfoFromGUI()
+{ cout << __func__ << endl;
+
+ /* //KEEP THIS FOR READING GGO FROM FILE
+ int argc=1;
+ std::string a = "toto";
+ char * const* argv = new char*;
+ //a.c_str();
+ struct cmdline_parser_params p;
+ p.check_required = 0;
+ int good = cmdline_parser_ext(argc, argv, &args_info, &p);
+ DD(good);
+ */
+/* cmdline_parser_clitkBinarizeImage_init(&mArgsInfo); // Initialisation to default
+ bool inverseBGandFG = false;
+
+ mArgsInfo.lower_given = 1;
+ mArgsInfo.lower_arg = mThresholdSlider1->GetValue();
+ if (mRadioButtonLowerThan->isChecked()) {
+ mArgsInfo.upper_given = 1;
+ mArgsInfo.upper_arg = mThresholdSlider2->GetValue();
+ if (mArgsInfo.upper_arg<mArgsInfo.lower_arg) {
+ mArgsInfo.upper_given = 0;
+ DD("TODO : lower thres greater than greater thres ! Ignoring ");
+ }
+ }
+
+ mArgsInfo.fg_arg = mFGSlider->GetValue();
+ mArgsInfo.bg_arg = mBGSlider->GetValue();
+
+ if (inverseBGandFG) {
+ mArgsInfo.fg_arg = mFGSlider->GetValue();
+ mArgsInfo.bg_arg = mBGSlider->GetValue();
+ }
+ mArgsInfo.fg_given = 1;
+ mArgsInfo.bg_given = 1;
+
+ if (mCheckBoxUseBG->isChecked()) {
+ if (mCheckBoxUseFG->isChecked()) mArgsInfo.mode_arg = (char*)"both";
+ else mArgsInfo.mode_arg = (char*)"BG";
+ } else mArgsInfo.mode_arg = (char*)"FG";
+
+ mArgsInfo.verbose_flag = false;
+
+ // // Required (even if not used)
+ // mArgsInfo.input_given = 0;
+ // mArgsInfo.output_given = 0;
+
+ // mArgsInfo.input_arg = new char;
+ // mArgsInfo.output_arg = new char;
+} */
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+void vvToolTest::valueChangedT1()
+{ cout << __func__ << endl;
+ // DD("valueChangedT1");
+ if (!mCurrentSlicerManager) close();
+ for(int i=0;i<mCurrentSlicerManager->GetNumberOfSlicers(); i++) {
+ //mImageContour[i]->Update(v);
+ }
+ mCurrentSlicerManager->Render();
+}
+//------------------------------------------------------------------------------
--- /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
+===========================================================================**/
+#ifndef VVTOOLTEST_H
+#define VVTOOLTEST_H
+
+#include <QtUiPlugin/QDesignerExportWidget>
+
+#include "vvToolBase.h"
+#include "vvToolWidgetBase.h"
+#include "vvImageContour.h"
+#include "ui_vvToolTest.h"
+
+
+//------------------------------------------------------------------------------
+class vvToolTest:
+ public vvToolWidgetBase,
+ public vvToolBase<vvToolTest>,
+ private Ui::vvToolTest
+{
+ Q_OBJECT
+ public:
+ vvToolTest(vvMainWindowBase * parent=0, Qt::WindowFlags f=0);
+ ~vvToolTest();
+
+ //-----------------------------------------------------
+ static void Initialize();
+ //void GetArgsInfoFromGUI();
+ virtual void InputIsSelected(vvSlicerManager * m);
+
+ //-----------------------------------------------------
+ public slots:
+ virtual bool close();
+ virtual void reject();
+ virtual void apply();
+ void UpdateSlice(int slicer,int slices);
+ void valueChangedT1();
+
+ protected:
+ Ui::vvToolTest ui;
+
+ void Update(int slicer);
+
+}; // end class vvToolTest
+//------------------------------------------------------------------------------
+
+#endif
+
vvToolWidgetBase::vvToolWidgetBase(vvMainWindowBase * parent, Qt::WindowFlags f, bool initialize):
QWidget(parent, f),
Ui::vvToolWidgetBase()
-{
+{ //out << __func__ << endl;
mMainWindow = parent;
setAttribute(Qt::WA_DeleteOnClose);
if (initialize) Initialization();
//------------------------------------------------------------------------------
void vvToolWidgetBase::Initialization()
-{
+{ //out << __func__ << endl;
mCurrentSlicerManager = 0;
mIsInitialized = false;
mFilter = 0;
//------------------------------------------------------------------------------
vvToolWidgetBase::~vvToolWidgetBase()
-{
+{ //out << __func__ << endl;
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void vvToolWidgetBase::keyPressEvent(QKeyEvent *event)
-{
+{ //out << __func__ << endl;
if (event->key() == Qt::Key_Escape) {
reject();
event->accept();
//------------------------------------------------------------------------------
void vvToolWidgetBase::accept()
-{
+{ //out << __func__ << endl;
apply();
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void vvToolWidgetBase::reject()
-{
+{ //out << __func__ << endl;
close();
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void vvToolWidgetBase::AddInputSelector(QString s, clitk::ImageToImageGenericFilterBase * f, bool allowSkip)
-{
+{ //out << __func__ << endl;
int j=0;
mFilter = f;
mSlicerManagersCompatible.clear();
//------------------------------------------------------------------------------
void vvToolWidgetBase::AddInputSelector(QString s, bool allowSkip)
-{
+{ //out << __func__ << endl;
mSlicerManagersCompatible.clear();
for(unsigned int i=0; i<mMainWindow->GetSlicerManagers().size(); i++) {
mSlicerManagersCompatible.push_back(mMainWindow->GetSlicerManagers()[i]);
//------------------------------------------------------------------------------
void vvToolWidgetBase::HideInputSelector()
-{
+{ //out << __func__ << endl;
mToolInputSelectionWidget->hide();
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void vvToolWidgetBase::show()
-{
+{ //out << __func__ << endl;
if (!mIsInitialized) {
mToolInputSelectionWidget->Initialize();
mIsInitialized = true;
//------------------------------------------------------------------------------
void vvToolWidgetBase::closeEvent(QCloseEvent *event)
-{
+{ //out << __func__ << endl;
mIsAnotherToolWaitInput = false;
if (isWindow()) {
event->accept();//return QWidget::close();
//------------------------------------------------------------------------------
bool vvToolWidgetBase::close()
-{
+{ //out << __func__ << endl;
QApplication::restoreOverrideCursor();
return QWidget::close();
}
//------------------------------------------------------------------------------
void vvToolWidgetBase::AnImageIsBeingClosed(vvSlicerManager * m)
-{
+{ //out << __func__ << endl;
mToolInputSelectionWidget->AnImageIsBeingClosed(m);
if (m == mCurrentSlicerManager) {
close();
//------------------------------------------------------------------------------
void vvToolWidgetBase::SwapCurrentWidget()
-{
+{ //out << __func__ << endl;
mStaticWidgetForTab->setUpdatesEnabled(false);
QList<QObject*> l =mStaticWidgetForTab->children();
for(int i=1; i<l.size(); i++) {
//------------------------------------------------------------------------------
void vvToolWidgetBase::SelectedImageHasChanged(vvSlicerManager * m)
-{
+{ //out << __func__ << endl;
if (!isWindow()) { // When the tool is not in a window, it is in a tab : we only display if needed
if (mCurrentSlicerManager == NULL) return;
if (mToolWidget == NULL) return;
//------------------------------------------------------------------------------
void vvToolWidgetBase::InitializeInputs()
-{
+{ //out << __func__ << endl;
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void vvToolWidgetBase::InputIsSelected()
-{
+{ //out << __func__ << endl;
mMainButtonBox->setEnabled(true);
std::vector<vvSlicerManager*> & l = mToolInputSelectionWidget->GetSelectedInputs();
mCurrentSlicerManager = l[0];
//------------------------------------------------------------------------------
void vvToolWidgetBase::InputIsSelected(vvSlicerManager * m)
-{
+{ //out << __func__ << endl;
std::cerr << "You MUST overwrite this method vvToolWidgetBase::InputIsSelected(vvSlicerManager * m) if you use one single input" << std::endl;
exit(0);
}
//------------------------------------------------------------------------------
void vvToolWidgetBase::InputIsSelected(std::vector<vvSlicerManager*> & l)
-{
+{ //out << __func__ << endl;
mMainButtonBox->setEnabled(true);
if (l.size() == 1) InputIsSelected(l[0]);
else {