def METHOD_NAME(obj, attach):
    if type(obj).__name__.startswith('itkImage'):
        img = obj
        size = list(img.GetLargestPossibleRegion().GetSize())
        values = itk.GetArrayFromImage(img).flatten(order='C')
        return {
            'vtkClass': 'vtkImageData',
            'dataDescription': 8,
            'direction': list(
                itk.GetArrayFromVnlMatrix(
                    img.GetDirection().GetVnlMatrix().as_matrix()
                ).flatten()
            ),
            'extent': [
                0, size[0] - 1,
                0, size[1] - 1,
                0, size[2] - 1,
            ],
            'spacing': list(img.GetSpacing()),
            'origin': list(img.GetOrigin()),
            'pointData': {
                'vtkClass': 'vtkDataSetAttributes',
                'activeScalars': 0,  # the index of the only array
                'arrays': [
                    {
                        'data': {
                            'vtkClass': 'vtkDataArray',
                            'size': len(values),
                            'values': attach(values.tobytes()),
                            'dataType': itk_image_pixel_type_to_js(img),
                            'numberOfComponents': img.GetNumberOfComponentsPerPixel(),
                            'name': 'Scalars',
                        }
                    }
                ]
            }
        }
    return obj