This might need to be openingFilter->SetInput(filter->GetOutput());
openingFilter->SetInput(filter->GetOutput());