From: Juan Prieto Date: Tue, 1 Sep 2009 13:59:48 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: EED.02Oct2009~6 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=2e1f522c4615a3a0f71575ece9e053860883eeec;p=bbtk.git *** empty log message *** --- diff --git a/kernel/cmake/BBTK_CONFIGUREQT.cmake b/kernel/cmake/BBTK_CONFIGUREQT.cmake new file mode 100644 index 0000000..bff794d --- /dev/null +++ b/kernel/cmake/BBTK_CONFIGUREQT.cmake @@ -0,0 +1,25 @@ + +#Doesn't work +SET(QT_DIR C:/Qt/2009.03/qt) + + +SET(QT_QMAKE_EXECUTABLE ${QT_DIR}/bin/qmake.exe) +SET(QT_CORE_INCLUDE_DIR ${QT_DIR}/include/QtCore) +SET(QT_QTCORE_LIBRARY_DEBUG ${QT_DIR}/lib/libQtCored4.a) +SET(QT_QTCORE_LIBRARY_RELEASE ${QT_DIR}/lib/libQtCore4.a) +SET(QT_MOC_EXECUTABLE ${QT_DIR}/bin/moc.exe) +SET(QT_UIC3_EXECUTABLE ${QT_DIR}/bin/uic3.exe) +SET(QT_UIC_EXECUTABLE ${QT_DIR}/bin/uic.exe) +SET(QT_RCC_EXECUTABLE ${QT_DIR}/bin/rcc.exe) +SET(QT_QTGUI_LIBRARY_DEBUG ${QT_DIR}/lib/libQtGuid4.a) +SET(QT_QTGUI_LIBRARY_RELEASE ${QT_DIR}/lib/libQtGuid4.a) +#Doesn't work + + + + +################# +################# +#For Microsoft Visual Studio 2003 +#Open a command window and execute C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\Tools\vsvars32.bat +#go to installation directory of qt C:\Qt\\qt and execute configure -platform win32-msvc2003 \ No newline at end of file diff --git a/packages/demo/bbs/appli/demoPlane3Pts.bbs b/packages/demo/bbs/appli/demoPlane3Pts.bbs new file mode 100644 index 0000000..5f8f30b --- /dev/null +++ b/packages/demo/bbs/appli/demoPlane3Pts.bbs @@ -0,0 +1,78 @@ +include vtk/boxes/bbLoadHola +load vtk +load wxvtk +load creaMaracasVisu +load std +load wx + +//new LoadHola image + +new FileSelector openFileDialog + set openFileDialog.Wildcard "(*.mhd)|*.mhd" +new MetaImageReader image + connect openFileDialog.Out image.In + +new ImagePlanes planes +connect image.Out planes.In + +#new Viewer3D viewer + +#connect planes.PlaneX viewer.Obs1 +#connect planes.PlaneY viewer.Obs2 +#connect planes.PlaneZ viewer.Obs3 +#connect planes.Plane3Pts viewer.Obs4 +#set viewer.WinTitle "Show N Points" +#set viewer.WinWidth 350 +#set viewer.WinHeight 400 + +new ViewerNV viewernv + #set viewernv.nTypeView "6 1 2 0" + set viewernv.nTypeView "6" + connect image.Out viewernv.In + + +new ShowNPoints showpoints + connect image.Out showpoints.Image + connect showpoints.lstPointsX planes.PointsX + connect showpoints.lstPointsY planes.PointsY + connect showpoints.lstPointsZ planes.PointsZ + #set planes.PointsX "10 10 50" + #set planes.PointsY "10 50 20" + #set planes.PointsZ "10 10 30" + connect viewernv.BoxChange showpoints.BoxExecute + connect viewernv.Point showpoints.In + connect viewernv.Renderer1 showpoints.Renderer + set showpoints.Radio 1 + +new ImageActor imgactor + connect planes.Image3Pts imgactor.In + connect viewernv.Renderer1 imgactor.Renderer + connect planes.Transform3Pts imgactor.Transform + + +new Viewer2D view2d +new CommandButton execplanes + set execplanes.Label "Refresh planes" + connect execplanes.BoxChange planes.BoxExecute + connect execplanes.BoxChange view2d.BoxExecute + connect execplanes.BoxChange imgactor.BoxExecute + #connect execplanes.BoxChange viewer.BoxExecute + +new LayoutLine layoutline0 +connect showpoints.Widget layoutline0.Widget1 +connect execplanes.Widget layoutline0.Widget2 + +new LayoutLine layoutline1 +connect viewernv.Widget layoutline1.Widget1 + +new LayoutSplit mainSplit +set mainSplit.Orientation H +set mainSplit.Proportion 10 +connect layoutline0.Widget mainSplit.Widget1 +connect layoutline1.Widget mainSplit.Widget2 + + +exec mainSplit + + +connect planes.Image3Pts view2d.In \ No newline at end of file diff --git a/packages/demo/bbs/appli/demoViewMulti.bbs b/packages/demo/bbs/appli/demoViewMulti.bbs new file mode 100644 index 0000000..2f78014 --- /dev/null +++ b/packages/demo/bbs/appli/demoViewMulti.bbs @@ -0,0 +1,81 @@ +load vtk +load wxvtk +load creaMaracasVisu +load std +load wx +load creaImageIO + +new Gimmick gimm0 + set gimm0.BoxProcessMode "Reactive" +new Gimmick gimm1 + set gimm1.BoxProcessMode "Reactive" + +new ViewerNV view0 + connect gimm0.BoxChange view0.BoxExecute + set view0.nTypeView "6" + connect gimm0.Out view0.In + +new ViewerNV view1 + connect gimm0.BoxChange view1.BoxExecute + set view1.nTypeView "-1" + connect gimm0.Out view1.In + +new ViewerNV view2 + connect gimm1.BoxChange view2.BoxExecute + set view2.nTypeView "-1" + connect gimm1.Out view2.In + + +new VolumeRendering volrend + connect view0.BoxChange volrend.BoxExecute + connect view0.Renderer1 volrend.Renderer + +new IRMViewer irmview + connect view0.BoxChange irmview.BoxExecute + connect view0.Renderer1 irmview.Renderer + +new CommandButton commandbutton0 + connect commandbutton0.BoxChange gimm0.BoxExecute + set commandbutton0.Label "Load image1" + +new CommandButton commandbutton1 + connect commandbutton1.BoxChange gimm1.BoxExecute + set commandbutton1.Label "Load image2" + +new LayoutLine layoutline0 + set layoutline0.Orientation V + connect commandbutton0.Widget layoutline0.Widget1 + connect commandbutton1.Widget layoutline0.Widget2 + connect irmview.Widget layoutline0.Widget3 + connect volrend.Widget layoutline0.Widget4 + +new LayoutSplit layoutline1 + set layoutline1.Orientation H + connect view0.Widget layoutline1.Widget1 + new LayoutLine layoutLine1o1 + connect view1.Widget layoutLine1o1.Widget1 + connect view2.Widget layoutLine1o1.Widget2 + connect layoutLine1o1.Widget layoutline1.Widget2 + +new LayoutSplit mainLayoutSplit + set mainLayoutSplit.Orientation H + connect layoutline0.Widget mainLayoutSplit.Widget1 + connect layoutline1.Widget mainLayoutSplit.Widget2 + + +new ViewerNV viewimage0 + set viewimage0.nTypeView "6 0 1 2" + connect gimm0.Out viewimage0.In + connect gimm0.BoxChange viewimage0.BoxExecute +new ViewerNV viewimage1 + set viewimage1.nTypeView "6 0 1 2" + connect gimm1.Out viewimage1.In + connect gimm1.BoxChange viewimage1.BoxExecute + +new LayoutTab mainLayoutTab + connect mainLayoutSplit.Widget mainLayoutTab.Widget1 + connect viewimage0.Widget mainLayoutTab.Widget2 + connect viewimage1.Widget mainLayoutTab.Widget3 + + +exec mainLayoutTab \ No newline at end of file diff --git a/packages/vtk/src/bbvtkImageCastToUShort.cxx b/packages/vtk/src/bbvtkImageCastToUShort.cxx new file mode 100644 index 0000000..06fdd14 --- /dev/null +++ b/packages/vtk/src/bbvtkImageCastToUShort.cxx @@ -0,0 +1,62 @@ +#include "bbvtkImageCastToUShort.h" +#include "bbvtkPackage.h" +namespace bbvtk +{ + +BBTK_ADD_BLACK_BOX_TO_PACKAGE(vtk,ImageCastToUShort) +BBTK_BLACK_BOX_IMPLEMENTATION(ImageCastToUShort,bbtk::AtomicBlackBox); +void ImageCastToUShort::Process() +{ + +// THE MAIN PROCESSING METHOD BODY +// Here we simply set the input 'In' value to the output 'Out' +// And print out the output value +// INPUT/OUTPUT ACCESSORS ARE OF THE FORM : +// void bbSet{Input|Output}NAME(const TYPE&) +// const TYPE& bbGet{Input|Output}NAME() const +// Where : +// * NAME is the name of the input/output +// (the one provided in the attribute 'name' of the tag 'input') +// * TYPE is the C++ type of the input/output +// (the one provided in the attribute 'type' of the tag 'input') + + vtkImageData* img = bbGetInputIn(); + cast->SetInput(img); + cast->SetOutputScalarTypeToUnsignedShort(); + cast->Update(); + bbSetOutputOut(cast->GetOutput() ); + +} +void ImageCastToUShort::bbUserSetDefaultValues() +{ + +// SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX +// Here we initialize the input 'In' to 0 + cast = NULL; + bbSetInputIn(0); + +} +void ImageCastToUShort::bbUserInitializeProcessing() +{ + +// THE INITIALIZATION METHOD BODY : +// Here does nothing +// but this is where you should allocate the internal/output pointers +// if any + + cast = vtkImageCast::New(); + +} +void ImageCastToUShort::bbUserFinalizeProcessing() +{ + +// THE FINALIZATION METHOD BODY : +// Here does nothing +// but this is where you should desallocate the internal/output pointers +// if any + +} +} +// EO namespace bbvtk + + diff --git a/packages/vtk/src/bbvtkImageCastToUShort.h b/packages/vtk/src/bbvtkImageCastToUShort.h new file mode 100644 index 0000000..92bb0e1 --- /dev/null +++ b/packages/vtk/src/bbvtkImageCastToUShort.h @@ -0,0 +1,40 @@ +#ifndef __bbvtkImageCastToUShort_h_INCLUDED__ +#define __bbvtkImageCastToUShort_h_INCLUDED__ +#include "bbvtk_EXPORT.h" +#include "bbtkAtomicBlackBox.h" +#include "iostream" + +#include "vtkImageData.h" +#include "vtkImageCast.h" + + +namespace bbvtk +{ + +class bbvtk_EXPORT ImageCastToUShort + : + public bbtk::AtomicBlackBox +{ + BBTK_BLACK_BOX_INTERFACE(ImageCastToUShort,bbtk::AtomicBlackBox); + BBTK_DECLARE_INPUT(In,vtkImageData*); + BBTK_DECLARE_OUTPUT(Out,vtkImageData*); + BBTK_PROCESS(Process); + void Process(); + +private: + vtkImageCast* cast; +}; + +BBTK_BEGIN_DESCRIBE_BLACK_BOX(ImageCastToUShort,bbtk::AtomicBlackBox); +BBTK_NAME("ImageCastToUShort"); +BBTK_AUTHOR("car-prie@uniandes.edu.co"); +BBTK_DESCRIPTION("Cast an Image to UShort"); +BBTK_CATEGORY("__CATEGORY__"); +BBTK_INPUT(ImageCastToUShort,In,"First input",vtkImageData*,""); +BBTK_OUTPUT(ImageCastToUShort,Out,"First output",vtkImageData*,""); +BBTK_END_DESCRIBE_BLACK_BOX(ImageCastToUShort); +} +// EO namespace bbvtk + +#endif // __bbvtkImageCastToUShort_h_INCLUDED__ + diff --git a/packages/vtk/src/bbvtkImagePlanes.cxx b/packages/vtk/src/bbvtkImagePlanes.cxx index 24d9f36..9f61f6e 100644 --- a/packages/vtk/src/bbvtkImagePlanes.cxx +++ b/packages/vtk/src/bbvtkImagePlanes.cxx @@ -2,8 +2,8 @@ Program: bbtk Module: $RCSfile: bbvtkImagePlanes.cxx,v $ Language: C++ - Date: $Date: 2009/07/02 07:17:33 $ - Version: $Revision: 1.29 $ + Date: $Date: 2009/09/01 13:59:48 $ + Version: $Revision: 1.30 $ =========================================================================*/ /* --------------------------------------------------------------------- @@ -137,7 +137,7 @@ namespace bbvtk }; //================================================================ - //vtkCxxRevisionMacro(ImagePlanes::VtkCallbackType, "$Revision: 1.29 $"); + //vtkCxxRevisionMacro(ImagePlanes::VtkCallbackType, "$Revision: 1.30 $"); //================================================================ @@ -330,6 +330,7 @@ void ImagePlanes::Process() if(pointsx.size()==pointsy.size() && pointsx.size()==pointsz.size()&&pointsx.size()>=3){ + //Get the corresponding three points out of the vectors double origin[3]; origin[0] = pointsx[0]; origin[1] = pointsy[0]; @@ -344,6 +345,7 @@ void ImagePlanes::Process() point2[1]= pointsy[2]; point2[2]= pointsz[2]; + //With the three points we create the corresponding X, Y and Z vectors all orthogonal to each other double* vect1= getNormal(makeVector(origin, point1)); double* vect2= getNormal(makeVector(origin, point2)); double* crossp = getCrossProduct(vect1, vect2); @@ -356,7 +358,7 @@ void ImagePlanes::Process() factor = ext[0]SetInput(bbGetInputIn()); double xSpacing, ySpacing, zSpacing; @@ -369,7 +371,7 @@ void ImagePlanes::Process() (origin[1]+vect2[1]*factor)*ySpacing, (origin[2]+vect2[2]*factor)*zSpacing); plane3pts->GetResliceOutput()->Update(); - +//To get the slice of image out of the selected volume if (_imageReslicer==NULL){ _imageReslicer = vtkImageReslice::New(); _imageReslicer->SetOutputDimensionality(2); @@ -379,9 +381,10 @@ void ImagePlanes::Process() } _imageReslicer->SetInput( bbGetInputIn() ); _imageReslicer->SetInformationInput(bbGetInputIn()); - _imageReslicer->SetResliceAxesDirectionCosines(newx[0],newx[1],newx[2], - vect2[0],vect2[1],vect2[2], - crossp[0],crossp[1],crossp[2]); + //fill out the information with the created vectors and using the spacing of the image + _imageReslicer->SetResliceAxesDirectionCosines(newx[0]*xSpacing,newx[1]*xSpacing,newx[2]*xSpacing, + vect2[0]*ySpacing,vect2[1]*ySpacing,vect2[2]*ySpacing, + crossp[0]*zSpacing,crossp[1]*zSpacing,crossp[2]*zSpacing); _imageReslicer->SetResliceAxesOrigin(origin[0]*xSpacing,origin[1]*ySpacing,origin[2]*zSpacing); _imageReslicer->GetOutput()->Update(); _imageReslicer->GetOutput()->UpdateInformation(); @@ -393,22 +396,23 @@ void ImagePlanes::Process() _matrix->Identity(); - _matrix->SetElement(0,0,newx[0]); - _matrix->SetElement(1,0,newx[1]); - _matrix->SetElement(2,0,newx[2]); - _matrix->SetElement(0,1,vect2[0]); - _matrix->SetElement(1,1,vect2[1]); - _matrix->SetElement(2,1,vect2[2]); - _matrix->SetElement(0,2,crossp[0]); - _matrix->SetElement(1,2,crossp[1]); - _matrix->SetElement(2,2,crossp[2]); - _matrix->SetElement(0,3,origin[0]); - _matrix->SetElement(1,3,origin[1]); - _matrix->SetElement(2,3,origin[2]); + _matrix->SetElement(0,0,newx[0]*xSpacing); + _matrix->SetElement(1,0,newx[1]*xSpacing); + _matrix->SetElement(2,0,newx[2]*xSpacing); + _matrix->SetElement(0,1,vect2[0]*ySpacing); + _matrix->SetElement(1,1,vect2[1]*ySpacing); + _matrix->SetElement(2,1,vect2[2]*ySpacing); + _matrix->SetElement(0,2,crossp[0]*zSpacing); + _matrix->SetElement(1,2,crossp[1]*zSpacing); + _matrix->SetElement(2,2,crossp[2]*zSpacing); + _matrix->SetElement(0,3,origin[0]*xSpacing); + _matrix->SetElement(1,3,origin[1]*ySpacing); + _matrix->SetElement(2,3,origin[2]*zSpacing); _transform->SetMatrix(_matrix); + //set the transformation out to be used by other bbBoxes bbSetOutputTransform3Pts((vtkLinearTransform*)_transform);