Transfer from VTK to SimpleITK

Please have patience with me. I come back because I have tried to use this example:

to import data from vtkImageData into sitk::Image through sitk::ImportImageFilter.

Here is the code:

sitk::ImportImageFilter importer;

int* nDim = m_pDICOMReader->GetOutput()->GetDimensions();
TRACE(">>>>%d|%d|%d\n", nDim[0], nDim[1], nDim[2]);
uint8_t* in = new uint8_t[nDim[0] * nDim[1] * nDim[2]];

double* dSpacing = m_pDICOMReader->GetOutput()->GetSpacing();
std::vector<double> spacing;
spacing.push_back(dSpacing[0]);
spacing.push_back(dSpacing[1]);
spacing.push_back(dSpacing[2]);
importer.SetSpacing(spacing);
double* dOrigin = m_pDICOMReader->GetOutput()->GetOrigin();
std::vector<double> origin;
origin.push_back(dOrigin[0]);
origin.push_back(dOrigin[1]);
origin.push_back(dOrigin[2]);
importer.SetOrigin(origin);
int nSize = m_pDICOMReader->GetOutput()->GetScalarSize();
std::vector<unsigned int> size;
size.push_back(nSize);
importer.SetSize(size);
importer.SetBufferAsUInt8(in);

try
{
	sitk::Image img = importer.Execute();
}
catch (sitk::GenericException& error)
{
	::SendMessage(theApp.m_pMainWnd->GetSafeHwnd(), WM_SETMESSAGESTRING, 0, (LPARAM)error.GetDescription());
}

but I got the following error:

sitk::ERROR: The length of size is invalid! Only image of dimension 2 or 3 are supported

What I have done wrong ? I really need this conversion in order to keep working ! Thank you for any help !