void FilesFromDirectory::CleanFilenames( std::string basePath )
{
std::string tmpString;
- int i,ii,sizeFilenames = Filenames.size();
- int j,sizeFileEnd = bbGetInputFileEnd().size();
-
+ int i,ii,sizeFilenames = Filenames.size();
+ int j,sizeFileEnd = bbGetInputFileEnd().size();
int okEraseElement;
-
+ int posStr;
//Selecting just the files in the FileEnd List
if (bbGetInputFileEnd().size()!=0)
{
for (i=sizeFilenames-1; i>=0; i--)
{
- okEraseElement=0;
+ okEraseElement = 0;
for (j=0; j<sizeFileEnd; j++)
{
- std::string tmp=Filenames[i].substr( (Filenames[i].length()) - (bbGetInputFileEnd()[j]).length() ) ;
- if (bbGetInputFileEnd()[j].compare( tmp )==0 )
+ posStr=(Filenames[i].length()) - (bbGetInputFileEnd()[j]).length();
+ if (posStr>=0)
{
- okEraseElement++;
- } // if FileEnd
+ std::string tmp=Filenames[i].substr( posStr ) ;
+ if (bbGetInputFileEnd()[j].compare( tmp )==0 )
+ {
+ okEraseElement++;
+ } // if FileEnd
+ }// if posStr
} // for j
if (okEraseElement==0)
}
} // for i
} // if FileEnd !=0
-
sizeFilenames = Filenames.size();
-
// Cleanning paths with spaces
for (i=0; i<sizeFilenames; i++)
{
tmpString=Filenames[i];
-
std::string::size_type spacePosition = tmpString.find_first_of(' ');
if (spacePosition != std::string::npos)
{
} // if spacePosition
}
-
// Alphabetical order
for (i=0; i<sizeFilenames; i++)
{
} // if
} // for ii
} // for i
-
// Creating SimpleFilenames
unsigned int lenghtBasePath = basePath.length();
for (i=0; i<sizeFilenames; i++)
{
SimpleFilenames.push_back( Filenames[i].substr( lenghtBasePath ) );
} // for i
-
}
// * TYPE is the C++ type of the input/output
// (the one provided in the attribute 'type' of the tag 'input')
- double spc[3];
int dim[3];
- int outputformat = VTK_UNSIGNED_SHORT;
-
- if (bbGetInputOutputFormat()=="VTK_BIT") outputformat = VTK_BIT; // 1
- else if (bbGetInputOutputFormat()=="VTK_CHAR") outputformat = VTK_CHAR; // 2
- else if (bbGetInputOutputFormat()=="MET_CHAR") outputformat = VTK_CHAR; // 2
- else if (bbGetInputOutputFormat()=="VTK_SIGNED_CHAR") outputformat = VTK_SIGNED_CHAR; // 15
- else if (bbGetInputOutputFormat()=="MET_UCHAR") outputformat = VTK_UNSIGNED_CHAR; // 3
- else if (bbGetInputOutputFormat()=="VTK_UNSIGNED_CHAR") outputformat = VTK_UNSIGNED_CHAR; // 3
- else if (bbGetInputOutputFormat()=="VTK_SHORT") outputformat = VTK_SHORT; // 4
- else if (bbGetInputOutputFormat()=="MET_SHORT") outputformat = VTK_SHORT; // 4
- else if (bbGetInputOutputFormat()=="VTK_UNSIGNED_SHORT") outputformat = VTK_UNSIGNED_SHORT; // 5
- else if (bbGetInputOutputFormat()=="MET_USHORT") outputformat = VTK_UNSIGNED_SHORT; // 5
- else if (bbGetInputOutputFormat()=="VTK_INT") outputformat = VTK_INT; // 6
- else if (bbGetInputOutputFormat()=="MET_INT") outputformat = VTK_INT; // 6
- else if (bbGetInputOutputFormat()=="VTK_UNSIGNED_INT") outputformat = VTK_UNSIGNED_INT; // 7
- else if (bbGetInputOutputFormat()=="MEY_UINT") outputformat = VTK_UNSIGNED_INT; // 7
- else if (bbGetInputOutputFormat()=="VTK_LONG") outputformat = VTK_LONG; // 8
- else if (bbGetInputOutputFormat()=="MET_LONG") outputformat = VTK_LONG; // 8
- else if (bbGetInputOutputFormat()=="VTK_UNSIGNED_LONG") outputformat = VTK_UNSIGNED_LONG; // 9
- else if (bbGetInputOutputFormat()=="MET_ULONG") outputformat = VTK_UNSIGNED_LONG; // 9
- else if (bbGetInputOutputFormat()=="VTK_FLOAT") outputformat = VTK_FLOAT; // 10
- else if (bbGetInputOutputFormat()=="MET_FLOAT") outputformat = VTK_FLOAT; // 10
- else if (bbGetInputOutputFormat()=="VTK_DOUBLE") outputformat = VTK_DOUBLE; // 11
- else if (bbGetInputOutputFormat()=="MET_DOUBLE") outputformat = VTK_DOUBLE; // 11
-
- spc[0] = bbGetInputSpacing()[0];
- spc[1] = bbGetInputSpacing()[1];
- spc[2] = bbGetInputSpacing()[2];
- dim[0] = bbGetInputDimensions()[0];
- dim[1] = bbGetInputDimensions()[1];
- dim[2] = bbGetInputDimensions()[2];
- if ((dim[0]<=0)||(dim[1]<=0)||(dim[2]<=0))
- {
- dim[0]=1;
- dim[1]=1;
- dim[2]=1;
- }
- if ((spc[0]<=0)||(spc[1]<=0)||(spc[2]<=0))
- {
- spc[0]=1;
- spc[1]=1;
- spc[2]=1;
- }
-//EED 2017-12-7
- if (imageoutput!=NULL) {imageoutput->Delete();}
- imageoutput = vtkImageData::New();
- imageoutput->Initialize();
- imageoutput->SetSpacing( spc );
- imageoutput->SetDimensions( dim[0], dim[1], dim[2] );
-
-//EED 2017-01-01 Migration VTK7
-#if (VTK_MAJOR_VERSION <= 5)
- imageoutput->SetScalarType( outputformat );
- imageoutput->AllocateScalars();
-#endif
-#if (VTK_MAJOR_VERSION >= 6)
- imageoutput->AllocateScalars( outputformat,1 );
-#endif
-
- int i,j,k;
- long sizeBlock;
+ dim[0] = bbGetInputDimensions()[0];
+ dim[1] = bbGetInputDimensions()[1];
+ dim[2] = bbGetInputDimensions()[2];
- for (i=0; i<dim[0]; i++)
+ if (imageoutput!=NULL)
{
- imageoutput->SetScalarComponentFromDouble(i,0,0, 0, bbGetInputInitialValue() );
- } // for i
-
- sizeBlock= dim[0] * imageoutput->GetScalarSize();
- for (j=1; j<dim[1]; j++)
- {
- memcpy( imageoutput->GetScalarPointer(0,j,0), imageoutput->GetScalarPointer() , sizeBlock );
- } // for j
+ imageoutput->Delete();
+ imageoutput = NULL;
+ } // if imageoutput
- sizeBlock= dim[0] * dim[1] * imageoutput->GetScalarSize();
- for (k=0; k<dim[2]; k++)
+ if ( !((dim[0]<=0)||(dim[1]<=0)||(dim[2]<=0)) )
{
- memcpy( imageoutput->GetScalarPointer(0,0,k) ,imageoutput->GetScalarPointer() , sizeBlock );
- } // for k
-
-
-//EED 2017-01-01 Migration VTK7
-#if (VTK_MAJOR_VERSION <= 5)
- imageoutput->Update();
-#endif
-#if (VTK_MAJOR_VERSION >= 6)
- // ..
-#endif
+ double spc[3];
+ int outputformat = VTK_UNSIGNED_SHORT;
+ spc[0] = bbGetInputSpacing()[0];
+ spc[1] = bbGetInputSpacing()[1];
+ spc[2] = bbGetInputSpacing()[2];
+ if (bbGetInputOutputFormat()=="VTK_BIT") outputformat = VTK_BIT; // 1
+ else if (bbGetInputOutputFormat()=="VTK_CHAR") outputformat = VTK_CHAR; // 2
+ else if (bbGetInputOutputFormat()=="MET_CHAR") outputformat = VTK_CHAR; // 2
+ else if (bbGetInputOutputFormat()=="VTK_SIGNED_CHAR") outputformat = VTK_SIGNED_CHAR; // 15
+ else if (bbGetInputOutputFormat()=="MET_UCHAR") outputformat = VTK_UNSIGNED_CHAR; // 3
+ else if (bbGetInputOutputFormat()=="VTK_UNSIGNED_CHAR") outputformat = VTK_UNSIGNED_CHAR; // 3
+ else if (bbGetInputOutputFormat()=="VTK_SHORT") outputformat = VTK_SHORT; // 4
+ else if (bbGetInputOutputFormat()=="MET_SHORT") outputformat = VTK_SHORT; // 4
+ else if (bbGetInputOutputFormat()=="VTK_UNSIGNED_SHORT") outputformat = VTK_UNSIGNED_SHORT; // 5
+ else if (bbGetInputOutputFormat()=="MET_USHORT") outputformat = VTK_UNSIGNED_SHORT; // 5
+ else if (bbGetInputOutputFormat()=="VTK_INT") outputformat = VTK_INT; // 6
+ else if (bbGetInputOutputFormat()=="MET_INT") outputformat = VTK_INT; // 6
+ else if (bbGetInputOutputFormat()=="VTK_UNSIGNED_INT") outputformat = VTK_UNSIGNED_INT; // 7
+ else if (bbGetInputOutputFormat()=="MEY_UINT") outputformat = VTK_UNSIGNED_INT; // 7
+ else if (bbGetInputOutputFormat()=="VTK_LONG") outputformat = VTK_LONG; // 8
+ else if (bbGetInputOutputFormat()=="MET_LONG") outputformat = VTK_LONG; // 8
+ else if (bbGetInputOutputFormat()=="VTK_UNSIGNED_LONG") outputformat = VTK_UNSIGNED_LONG; // 9
+ else if (bbGetInputOutputFormat()=="MET_ULONG") outputformat = VTK_UNSIGNED_LONG; // 9
+ else if (bbGetInputOutputFormat()=="VTK_FLOAT") outputformat = VTK_FLOAT; // 10
+ else if (bbGetInputOutputFormat()=="MET_FLOAT") outputformat = VTK_FLOAT; // 10
+ else if (bbGetInputOutputFormat()=="VTK_DOUBLE") outputformat = VTK_DOUBLE; // 11
+ else if (bbGetInputOutputFormat()=="MET_DOUBLE") outputformat = VTK_DOUBLE; // 11
+
+ if ((dim[0]<=0)||(dim[1]<=0)||(dim[2]<=0))
+ {
+ dim[0]=1;
+ dim[1]=1;
+ dim[2]=1;
+ }
+ if ((spc[0]<=0)||(spc[1]<=0)||(spc[2]<=0))
+ {
+ spc[0]=1;
+ spc[1]=1;
+ spc[2]=1;
+ }
+ imageoutput = vtkImageData::New();
+ imageoutput->Initialize();
+ imageoutput->SetSpacing( spc );
+ imageoutput->SetDimensions( dim[0], dim[1], dim[2] );
+
+ //EED 2017-01-01 Migration VTK7
+ #if (VTK_MAJOR_VERSION <= 5)
+ imageoutput->SetScalarType( outputformat );
+ imageoutput->AllocateScalars();
+ #endif
+ #if (VTK_MAJOR_VERSION >= 6)
+ imageoutput->AllocateScalars( outputformat,1 );
+ #endif
+
+ int i,j,k;
+ long sizeBlock;
+
+ for (i=0; i<dim[0]; i++)
+ {
+ imageoutput->SetScalarComponentFromDouble(i,0,0, 0, bbGetInputInitialValue() );
+ } // for i
+
+ sizeBlock= dim[0] * imageoutput->GetScalarSize();
+ for (j=1; j<dim[1]; j++)
+ {
+ memcpy( imageoutput->GetScalarPointer(0,j,0), imageoutput->GetScalarPointer() , sizeBlock );
+ } // for j
+
+ sizeBlock= dim[0] * dim[1] * imageoutput->GetScalarSize();
+ for (k=0; k<dim[2]; k++)
+ {
+ memcpy( imageoutput->GetScalarPointer(0,0,k) ,imageoutput->GetScalarPointer() , sizeBlock );
+ } // for k
+
+
+ //EED 2017-01-01 Migration VTK7
+ #if (VTK_MAJOR_VERSION <= 5)
+ imageoutput->Update();
+ #endif
+ #if (VTK_MAJOR_VERSION >= 6)
+ // ..
+ #endif
+ imageoutput->Modified();
+ } // if dim = 0
- imageoutput->Modified();
bbSetOutputOut(imageoutput);
}
_imageoutput=bbGetInputImageFix();
}
-
-
// Copy the Move Image
int j,k;
int px,py,pz;
int dimMoveX = ext[1]-ext[0]+1;
int dimMoveY = ext[3]-ext[2]+1;
int dimMoveZ = ext[5]-ext[4]+1;
-
int spxM = 0; // start px MoveImage
int sizeXM = 0; // sizeX MoveImage
-
px = bbGetInputOrigin()[0];
spxM = 0;
if (px<0)
{
- spxM=px*(-1);
- px=0;
+ spxM = px*(-1);
+ px = 0;
}
sizeXM = dimMoveX-spxM;
if (px+sizeXM>=dim[0]) sizeXM=dim[0]-px;
- sizeXM=sizeXM*bbGetInputImageFix()->GetScalarSize();
+ sizeXM = sizeXM * bbGetInputImageFix()->GetScalarSize();
for (k=0; k<dimMoveZ; k++)
{
for (j=0; j<dimMoveY; j++)
{
- py=j+bbGetInputOrigin()[1];
- pz=k+bbGetInputOrigin()[2];
+ py = j+bbGetInputOrigin()[1];
+ pz = k+bbGetInputOrigin()[2];
if ( (py<dim[1]) && (pz<dim[2]) &&
(py>=0) && (pz>=0) &&
(sizeXM>0) )
} // for j
} // for k
_imageoutput->Modified();
- } // If Image Fixe Move the same GetScalarType
- else {
+ } else { // If Image Fixe Move the same GetScalarType
printf ("ERROR: InversCrop both ImageFixe and ImageMove need the same format.\n");
printf (" type ImageFix:%d type ImageMove:%d\n", bbGetInputImageFix()->GetScalarType(), bbGetInputImageMove()->GetScalarType() );
}
- } // If Image Fixe Move != NULL
- else {
- printf ("ERROR: InversCrop need ImageFixe and ImageMove to run.\n");
- }
- bbSetOutputOut(_imageoutput);
+ } else { // If Image Fixe Move != NULL
+ printf ("ERROR: InversCrop need ImageFixe and ImageMove to run.\n");
+ }
+ bbSetOutputOut(_imageoutput);
} // if Active
mBox(box),
mTypeForm(typeForm)
{
- wxPanel *panel = this;
itemcontainer = NULL;
- int i;
-
+ wxPanel *panel = this;
+ int i;
//---------------------------------------------------------------------
// 2) Insertion of the components in the window
wxChoice *wxchoice = new wxChoice ( panel , -1, wxDefaultPosition,wxSize(sizeX,sizeY));
itemcontainer=wxchoice;
sizer->Add( wxchoice,1,wxGROW );
-
Connect( wxchoice->GetId(),
wxEVT_COMMAND_CHOICE_SELECTED, (wxObjectEventFunction) (void (wxPanel::*)(wxEvent&))&ComboBoxWidget::OnComboBox );
}
mBox->bbSetOutputOut( iSelection );
mBox->bbSetOutputOutString( bbtk::wx2std( itemcontainer->GetString(iSelection) ) );
mBox->bbSignalOutputModification();
-
VerifyDeselect(iSelection);
-
if (mTypeForm==0)
{
wxChoice *wxchoise=(wxChoice *)itemcontainer;
} // if iSelection
}
- //--------------------------------------------------------------------------
- void ComboBoxWidget::OnComboBox(wxEvent& event)
- {
+//--------------------------------------------------------------------------
+void ComboBoxWidget::OnComboBox(wxEvent& event)
+{
OnComboBoxSelection( itemcontainer->GetSelection() );
- }
+}
+
//--------------------------------------------------------------------------
- void ComboBoxWidget::FillItems( int iSelection, std::vector< std::string > lstIn )
+void ComboBoxWidget::FillItems( int iSelection, std::vector< std::string > lstIn )
+{
+ int i;
+ itemcontainer->Clear();
+ for (i=0;i<lstIn.size(); i++)
{
- int i;
- itemcontainer->Clear();
- for (i=0;i<lstIn.size(); i++)
- {
- itemcontainer->Append( bbtk::std2wx( lstIn[i] ) );
- } // for i
- if (iSelection>=0) itemcontainer->SetSelection(iSelection);
- }
+ itemcontainer->Append( bbtk::std2wx( lstIn[i] ) );
+ } // for i
+ if (iSelection>=0) itemcontainer->SetSelection(iSelection);
+}
BBTK_ADD_BLACK_BOX_TO_PACKAGE(wx,ComboBox)
BBTK_BLACK_BOX_IMPLEMENTATION(ComboBox,bbtk::WxBlackBox);
+
//=====
// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
//=====
{
bbSetOutputOutString( bbGetInputIn()[ iSelection ] );
} // if iSelection
-
w->VerifyDeselect(iSelection);
}
//=====
bbGetInputForm(),
bbGetInputWinWidth(), bbGetInputWinHeight() );
bbSetOutputOut( bbGetInputSelection() );
- bbSetOutputOutString( bbGetInputIn()[ bbGetInputSelection() ] );
+ if (bbGetInputIn().size()> bbGetInputSelection() )
+ {
+ bbSetOutputOutString( bbGetInputIn()[ bbGetInputSelection() ] );
+ } // if InputIn size
bbSetOutputWidget( w );
}
//=====