#load wxvtk
load kw
-new LoadHola image
+new LoadHola reader
//new PiecewiseFunction color
new kwTransferFunctionEditor color
new kwTransferFunctionEditor opacity
new VolumeRenderer renderer
new kwViewer3D viewer
-connect image.Out color.In
-connect image.Out opacity.In
-connect image.Out renderer.In
+connect reader.Out color.In
+connect reader.Out opacity.In
+connect reader.Out renderer.In
connect color.Out renderer.ColorFunction
connect opacity.Out renderer.OpacityFunction
connect renderer.Out viewer.In1
help kwVolumeRendererWidget
message echo 2
-new LoadHola image
+new LoadHola reader
new kwVolumeRendererWidget renderer
new kwViewer3D viewer
-connect image.Out renderer.In
+connect reader.Out renderer.In
connect renderer.Out viewer.In1
connect renderer.BoxChange viewer.BoxExecute
--- /dev/null
+ObjectType = Image
+NDims = 3
+DimSize = 127 147 187
+ElementType = MET_USHORT
+HeaderSize = 0
+ElementNumberOfChannels = 1
+
+ElementSpacing = 0.7 0.7 0.7
+Position = 0 0 0
+TransformMatrix = 1 0 0 0 1 0 0 0 1
+Offset = 0 0 0
+CenterOfRotation = 0 0 0
+
+BinaryData = True
+BinaryDataByteOrderMSB = False
+CompressedData = False
+
+ElementDataFile = hola.raw
Program: bbtk
Module: $RCSfile: bbvtkConcatImages.cxx,v $
Language: C++
- Date: $Date: 2010/04/08 14:39:45 $
- Version: $Revision: 1.1 $
+ Date: $Date: 2010/04/28 22:10:07 $
+ Version: $Revision: 1.2 $
=========================================================================*/
/* ---------------------------------------------------------------------
void ConcatImages::Process()
{
int dim[3];
+ int nbComponents;
+ int scalarType;
int nb = (unsigned int)bbGetInputIn().size();
- if (nb == 0) {} // ??? JPR
+ int consistentNb(nb);
+
+ if (nb == 0) {
+ // ??? JPR
+ }
bbGetInputIn()[0]->GetDimensions(dim);
if (dim[2] > 1 || nb == 1) // dim[2] > 1 : Hopeless for vtk : the first file contains already a 3D object
//std::cout << "--------PrintSelf firstImage " << std::endl;
// firstImage->PrintSelf(std::cout, vtkIndent(2));
- int nbComponents = firstImage->GetNumberOfScalarComponents();
+ nbComponents = firstImage->GetNumberOfScalarComponents();
mConcat->SetNumberOfScalarComponents(nbComponents);
- mConcat->SetScalarType(firstImage->GetScalarType( ));
- firstImage->GetDimensions(dim);
- dim[2]=nb;
- mConcat->SetDimensions(dim);
- mConcat->SetExtent(0, dim[0]-1, 0, dim[1]-1, 0, dim[2]-1);
+
+ mConcat->SetScalarType(firstImage->GetScalarType( ));
+ scalarType = firstImage->GetScalarType( );
+ mConcat->SetScalarType(scalarType);
+
mConcat->SetSpacing(firstImage->GetSpacing());
+ firstImage->GetDimensions(dim);
+ // brute way to perform an ultra-mini consistency check :
+ // First image is supposed to be the reference image,
+ // any unconsistent image is just discarted...
+ for(int i=0; i<nb; i++)
+ {
+ if ( !CheckConsistency(firstImage, dim, nbComponents, scalarType))
+ consistentNb--;
+ }
+
+ dim[2]=consistentNb;
+ mConcat->SetDimensions(dim);
+ mConcat->SetExtent(0, dim[0]-1, 0, dim[1]-1, 0, dim[2]-1);
+
mConcat->AllocateScalars();
mConcat->Update();
for(index_image=0; index_image<nb; index_image++)
{
+ if (!CheckConsistency(bbGetInputIn()[index_image], dim, nbComponents, scalarType))
+ continue; // discard unconsistent image !
for(index_lignes=0; index_lignes<dim[0];index_lignes++)
{
for(index_colonnes=0; index_colonnes<dim[1];index_colonnes++)
bbSetOutputOut(mConcat);
}
+bool ConcatImages::CheckConsistency( vtkImageData *curImage, int dim[], int nbComponents, int scalarType )
+{
+ assert (curImage);
+
+ if (scalarType != curImage->GetScalarType( ) )
+ return false;
+
+ if (nbComponents != curImage->GetNumberOfScalarComponents() )
+ return false;
+
+ int curDim[3];
+ curImage->GetDimensions(curDim);
+ if ( (curDim[0] =! dim[0]) || (curDim[1] =! dim[1]) )
+ return false;
+
+ return true;
+}
+
+
}//namespace bbtk
#endif // _USE_VTK_
include vtk/boxes/bbLoadHola
include wxvtk/boxes/bbDoubleSlicer
-new LoadHola image1
-new LoadHola image2
+new LoadHola reader1
+new LoadHola reader2
new DoubleSlicer viewer
-connect image1.Out viewer.In1
-connect image2.Out viewer.In2
+connect reader1.Out viewer.In1
+connect reader2.Out viewer.In2
load std
set viewer.WinTitle "ExampleDoubleSlicer"
load vtk
load wxvtk
-new LoadHola image
+new LoadHola reader
new ImagePlanes planes
new Viewer3D viewer
-connect image.Out planes.In
+connect reader.Out planes.In
connect planes.PlaneX viewer.Obs1
connect planes.PlaneY viewer.Obs2
connect planes.PlaneZ viewer.Obs3
load wxvtk
new Viewer3D viewer
-#bad trick, waiting for a bug fix... : load twice the image :-(
-new LoadHola image1
-//new LoadHola image2
+new LoadHola reader1
-connect image1.Out surface1.In
-//connect image2.Out surface2.In
-connect image1.Out surface2.In
+connect reader1.Out surface1.In
+connect reader1.Out surface2.In
set surface1.Isovalue 100
set surface1.Opacity 100
load wxvtk
new Viewer3D viewer
-new LoadHola image
+new LoadHola reader
-connect image.Out MIP.In
+connect reader.Out MIP.In
connect MIP.Out viewer.In1
connect MIP.BoxChange viewer.BoxExecute
include vtk/boxes/bbLoadHola
include wxvtk/boxes/bbSimpleIsoSurfaceViewer
-new LoadHola image
+new LoadHola reader
new SimpleIsoSurfaceViewer viewer
-connect image.Out viewer.In
+connect reader.Out viewer.In
load std
set viewer.WinTitle "ExampleSimpleIsoSurfaceViewer"
include wxvtk/boxes/bbSimpleSlicer
-new LoadHola image
+new LoadHola reader
new SimpleSlicer viewer
-connect image.Out viewer.In
+connect reader.Out viewer.In
load std
set viewer.WinTitle "ExampleSimpleSlicer"
set viewer.WinWidth 350
set viewer.WinHeight 400
-# Crashes ! why ?
-#set viewer.Slice 20
+
+set viewer.Slice 20
exec viewer
author "laurent.guigues at creatis.insa-lyon.fr"
category "example"
-include vtk/boxes/bbLoadHola
-include wxvtk/boxes/bbIsoSurfaceWidget
load vtk
load wxvtk
+include vtk/boxes/bbLoadHola
+include wxvtk/bbs/boxes/bbIsoSurfaceWidget
-new LoadHola image
+new LoadHola reader
new ImagePlanes planes
new IsoSurfaceWidget surface
new Viewer3D viewer
-connect image.Out planes.In
+connect reader.Out planes.In
connect planes.PlaneX viewer.Obs1
connect planes.PlaneY viewer.Obs2
connect planes.PlaneZ viewer.Obs3
-connect image.Out surface.In
+connect reader.Out surface.In
connect surface.Out viewer.In1
connect surface.BoxChange viewer.BoxExecute
load vtk
load wxvtk
-new LoadHola image
+new LoadHola reader
new ImagePlanes planes
new IsoSurfaceWidget surface
new Viewer3D viewer
-connect image.Out planes.In
+connect reader.Out planes.In
connect planes.PlaneX viewer.Obs1
connect planes.PlaneY viewer.Obs2
connect planes.PlaneZ viewer.Obs3
-connect image.Out surface.In
+connect reader.Out surface.In
connect surface.Out viewer.In1
connect surface.BoxChange viewer.BoxExecute
include vtk/boxes/bbLoadHola
load wxvtk
-new LoadHola image
+new LoadHola reader
new Viewer2D viewer
-connect image.Out viewer.In
+connect reader.Out viewer.In
# To get the string to int adaptor and set the slice
load std
include vtk
load wxvtk
-new LoadHola image
+new LoadHola reader
new PiecewiseFunction color
new PiecewiseFunction opacity
new VolumeRenderer renderer
new Viewer3D viewer
-connect image.Out renderer.In
+connect reader.Out renderer.In
connect color.Out renderer.ColorFunction
connect opacity.Out renderer.OpacityFunction
connect renderer.Out viewer.In1
help Viewer2D
message echo 2
-new LoadHola image
+new LoadHola reader
new Viewer2D viewer
-connect image.Out viewer.In
+connect reader.Out viewer.In
set viewer.Slice 20
set viewer.WinDialog true
exec viewer
help SimpleSlicer
message echo 2
-new LoadHola image
+new LoadHola reader
new SimpleSlicer viewer
-connect image.Out viewer.In
+connect reader.Out viewer.In
set viewer.WinDialog true
exec viewer
help DoubleSlicer
message echo 2
-new LoadHola image
+new LoadHola reader
new DoubleSlicer viewer
-connect image.Out viewer.In1
-connect image.Out viewer.In2
+connect reader.Out viewer.In1
+connect reader.Out viewer.In2
set viewer.WinDialog true
exec viewer
message echo 2
-new LoadHola image
+new LoadHola reader
new ImagePlanes planes
new Viewer3D viewer
-connect image.Out planes.In
+connect reader.Out planes.In
connect planes.PlaneX viewer.Obs1
connect planes.PlaneY viewer.Obs2
connect planes.PlaneZ viewer.Obs3
help SimpleIsoSurfaceViewer
message echo 2
-new LoadHola image
+new LoadHola reader
new SimpleIsoSurfaceViewer viewer
-connect image.Out viewer.In
+connect reader.Out viewer.In
set viewer.WinDialog true
exec viewer
help IsoSurfaceWidget
message echo 2
-new LoadHola image
+new LoadHola reader
new Viewer3D viewer
new ImagePlanes planes
-connect image.Out planes.In
+connect reader.Out planes.In
connect planes.PlaneX viewer.Obs1
connect planes.PlaneY viewer.Obs2
connect planes.PlaneZ viewer.Obs3
new IsoSurfaceWidget isosurface
-connect image.Out isosurface.In
+connect reader.Out isosurface.In
connect isosurface.Out viewer.In1
connect isosurface.BoxChange viewer.BoxExecute
help VolumeRenderer
message echo 2
-new LoadHola image
+new LoadHola reader
new PiecewiseFunction color
new PiecewiseFunction opacity
new VolumeRenderer renderer
new Viewer3D viewer
-connect image.Out renderer.In
+connect reader.Out renderer.In
connect color.Out renderer.ColorFunction
connect opacity.Out renderer.OpacityFunction
connect renderer.Out viewer.In1