Hi David,
Nice idea. It can be done without problems right now. Do you know how the ScreenTransferFunction and HistogramTransformation tools work together? As you probably know, you can drag a STF icon to HT's control bar, and HT imports the STF instance. Similarly, you can drag an HT icon to STF.
As long as all processes are defined in the same module, they can share/import instances. You have the full source code of the IntensityTransformations module in all PCL distributions, so you can see how this works for HT and STF; what you want to do is just the same, basically.
This is a skeleton of how you should work with several instances in your ImagingSessionInterface:
bool ImagingSessionInterface::ValidateProcess( const ProcessImplementation& p, String& whyNot ) const
{
if ( dynamic_cast<const ExposeImageInstance*>( &p ) == 0 &&
dynamic_cast<const AutoFocusInstance*>( &p ) == 0 )
{
whyNot = "Must be an instance of either ExposeImage or AutoFocus.";
return false;
}
whyNot.Clear();
return true;
}
bool ImagingSessionInterface::ImportProcess( const ProcessImplementation& p )
{
const ExposeImageInstance* ei = dynamic_cast<const ExposeImageInstance*>( &p );
if ( ei != 0 )
{
// We are importing an ExposeImage instance
...
}
else
{
const AutoFocusInstance* af = dynamic_cast<const AutoFocusInstance*>( &p );
if ( af != 0 )
{
// We are importing an AutoFocus instance
...
}
else
{
// Hmmm, this is odd; this cannot happen because we have validated
// the instance to ensure it is either ExposeImage or AutoFocus
return false;
}
}
return true;
}
Right now an instance can only be imported by a process interface by dragging it to its control bar. You cannot drag an instance to a control inside a process interface. That would be very nice because in that way the drag&drop actions would be more intuitive. I'll think on a way to overcome this limitation.
Besides that cosmetic limitation, you can import different instances as above, then allow the user to move them up and down on your interface to refine the sequence, if necessary.
HTH