BBTK_ADD_BLACK_BOX_TO_PACKAGE(gdcmvtk,GetXCoherentInfoGdcmReader)
BBTK_BLACK_BOX_IMPLEMENTATION(GetXCoherentInfoGdcmReader,bbtk::AtomicBlackBox);
+
+
+vtkImageData* GetXCoherentInfoGdcmReader::CreateDefaultImage()
+{
+ int i;
+ int sizeX, sizeY, sizeZ;
+ sizeX = 200;
+ sizeY = sizeX;
+ sizeZ = 1;
+ vtkImageData *newImage = vtkImageData::New();
+ newImage->Initialize();
+ newImage->SetScalarTypeToUnsignedChar();
+ newImage->SetSpacing( 1,1,1 );
+ newImage->SetDimensions( sizeX,sizeY,sizeZ );
+ newImage->SetWholeExtent(0, sizeX-1,0,sizeY-1,0,sizeZ-1 );
+ newImage->SetExtent(0, sizeX-1,0,sizeY-1,0,sizeZ-1 );
+ newImage->SetNumberOfScalarComponents(1);
+ newImage->AllocateScalars();
+ newImage->Update();
+ memset ( (void*)newImage->GetScalarPointer(), 0, sizeX*sizeY*1 );
+ for (i=0; i<sizeX; i++)
+ {
+ newImage->SetScalarComponentFromDouble(i,i,0, 0, 255 );
+ newImage->SetScalarComponentFromDouble(i,sizeY-1-i,0, 0, 255 );
+ } // for i
+ return newImage;
+}
+
+
#if defined USE_GDCM
void GetXCoherentInfoGdcmReader::Process()
{
bool res = f->Load();
if ( !res )
{
- f->Delete();
- bbSetOutputOut(0);
- return;
+ printf("EED GetXCoherentInfoGdcmReader::Process resultImage NULL\n");
+ f->Delete();
+ bbSetOutputOut( CreateDefaultImage() );
+ return;
}
// Get info from the first image file
int i;
if ( !res )
{
delete read;
- printf("EED GetXCoherentInfoGdcmReader::Process resultImage NULL\n");
bbSetOutputOut(NULL);
return;
}
BBTK_PROCESS(Process);
void Process();
+ vtkImageData* CreateDefaultImage();
+
+
private:
#if defined USE_GDCM
void ImageReader::Read()
{
-printf("EED ImageReader::Read start\n");
std::string filename = bbGetInputIn();
-
itk::ImageIOBase::Pointer genericReader =
itk::ImageIOFactory::CreateImageIO(filename.c_str(),
itk::ImageIOFactory::ReadMode);
}
genericReader->SetFileName(filename.c_str());
genericReader->ReadImageInformation();
-
bbtk::TypeInfo typ = GetITKImagePtrTypeInfoFromPixelTypeInfoAndDimension(genericReader->GetComponentTypeInfo(), genericReader->GetNumberOfDimensions());
-
BBTK_TEMPLATE_ITK_IMAGE_SWITCH( typ, Read);
-
-printf("EED ImageReader::Read end\n");
-
}
template <class T>
void GetSubVector<T>::DoIt()
{
- int i;
+ int i,iStart,iEnd;
+ iStart = bbGetInputI();
+ iEnd = bbGetInputI() + bbGetInputSize() - 1;
+ if (iStart<0) { iStart = 0; }
+ if (iEnd<0) { iEnd = 0; }
+ if (iStart>bbGetInputIn().size() ) { iStart = bbGetInputIn().size(); }
+ if (iEnd>bbGetInputIn().size() ) { iEnd = bbGetInputIn().size(); }
+
+
+
std::vector<T> tmpVectResult;
- if ( (bbGetInputI()<(int)bbGetInputIn().size()) && (bbGetInputI()>=0) && (bbGetInputSize()>=1) )
+ if (bbGetInputSize()>=1)
{
- for ( i=0 ; i<bbGetInputSize() ; i++)
+ for ( i=iStart ; i<iEnd ; i++)
{
- if ( bbGetInputI()+i<(int)bbGetInputIn().size() )
+ if ( i<(int)bbGetInputIn().size() )
{
- tmpVectResult.push_back( bbGetInputIn()[bbGetInputI()+i] );
+ tmpVectResult.push_back( bbGetInputIn()[i] );
} // if InputI+i
}// for
--- /dev/null
+# ----------------------------------
+# - BBTKGEditor v 1.4 BBG BlackBox Diagram file
+# - /tmpEED/creaTools/creatools_source/bbtk/packages/vtk/bbs/boxes/RescaleSlopeIntercept_Interface.bbg
+# ----------------------------------
+
+APP_START
+CATEGORY:<VOID>
+DESCRIPTION:Description ??
+AUTHOR:Author ??
+COMPLEXBOX:TRUE
+COMPLEXBOXNAME:RescaleReslopeIntercept_Interface
+PACKAGENAME:vtk
+COMPLEXOUTPUTS:0
+COMPLEXINPUTS:0
+BOXES:7
+BOX
+wx:InputText:Box00
+ISEXEC:FALSE
+-30.237120:75.209079:-900.000000
+15.337880:65.209079:-900.000000
+PORT
+In:"1"
+PORT
+Title:"A"
+FIN_BOX
+BOX
+wx:InputText:Box01
+ISEXEC:FALSE
+11.558165:60.520810:-900.000000
+57.133165:50.520810:-900.000000
+PORT
+In:"0"
+PORT
+Title:"B"
+FIN_BOX
+BOX
+wx:LayoutLine:Box06
+ISEXEC:TRUE
+-20.720869:-38.371979:-900.000000
+36.839131:-48.371979:-900.000000
+FIN_BOX
+BOX
+wx:ComboBox:Box07
+ISEXEC:FALSE
+17.037159:29.469680:-900.000000
+62.612159:19.469680:-900.000000
+PORT
+In:"SlopeIntercept(np=A*p+B) Invert Redimension(A=newMin;B=newMax)"
+PORT
+Title:"Type"
+FIN_BOX
+BOX
+wx:ComboBox:Box08
+ISEXEC:FALSE
+35.195304:11.711652:-900.000000
+80.770304:1.711652:-900.000000
+PORT
+In:"Same(default) VTK_BIT VTK_CHAR VTK_UNSIGNED_CHAR VTK_INT VTK_UNSIGNED_INT VTK_SHORT VTK_UNSIGNED_SHORT VTK_LONG VTK_UNSIGNED_LONG VTK_FLOAT VTK_DOUBLE"
+PORT
+Title:"Format"
+FIN_BOX
+BOX
+wx:CommandButton:Box09
+ISEXEC:FALSE
+28.395265:-15.962743:-900.000000
+73.970265:-25.962743:-900.000000
+PORT
+Label:"Save (*.mhd)"
+FIN_BOX
+BOX
+vtk:RescaleSlopeIntercept:Box10
+ISEXEC:FALSE
+-95.009021:6.753468:-900.000000
+-23.834021:-3.246532:-900.000000
+FIN_BOX
+CONNECTIONS:5
+CONNECTION
+Box00:Widget:Box06:Widget1
+NumberOfControlPoints:0
+CONNECTION
+Box01:Widget:Box06:Widget2
+NumberOfControlPoints:0
+CONNECTION
+Box07:Widget:Box06:Widget3
+NumberOfControlPoints:0
+CONNECTION
+Box09:Widget:Box06:Widget5
+NumberOfControlPoints:0
+CONNECTION
+Box08:Widget:Box06:Widget4
+NumberOfControlPoints:0
+APP_END
--- /dev/null
+# ----------------------------------
+# - BBTKGEditor v 1.4 BBS BlackBox Script (Complex Box)
+# - /tmpEED/creaTools/creatools_source/bbtk/packages/vtk/bbs/boxes/RescaleSlopeIntercept_Interface.bbs
+# ----------------------------------
+
+include std
+include itkvtk
+include wx
+include vtk
+
+define RescaleReslopeIntercept_Interface vtk
+
+author "Author ??"
+description "Description ??"
+
+category "<VOID>"
+
+new wx:InputText Box00
+ set Box00.In "1"
+ set Box00.Title "A"
+
+new wx:InputText Box01
+ set Box01.In "0"
+ set Box01.Title "B"
+
+new wx:LayoutLine Box06
+
+new wx:ComboBox Box07
+ set Box07.In "SlopeIntercept(np=A*p+B) Invert Redimension(A=newMin;B=newMax)"
+ set Box07.Title "Type"
+
+new wx:ComboBox Box08
+ set Box08.In "Same(default) VTK_BIT VTK_CHAR VTK_UNSIGNED_CHAR VTK_INT VTK_UNSIGNED_INT VTK_SHORT VTK_UNSIGNED_SHORT VTK_LONG VTK_UNSIGNED_LONG VTK_FLOAT VTK_DOUBLE"
+ set Box08.Title "Format"
+
+new wx:CommandButton Box09
+ set Box09.Label "Save (*.mhd)"
+
+new vtk:RescaleSlopeIntercept Box10
+
+
+connect Box00.Widget Box06.Widget1
+connect Box01.Widget Box06.Widget2
+connect Box07.Widget Box06.Widget3
+connect Box09.Widget Box06.Widget5
+connect Box08.Widget Box06.Widget4
+
+# Complex input ports
+
+# Complex output ports
+
+message 0
+exec Box06
+
+endefine