vtk polydata file

I used to convert nifti file to .vtk file but what I noticed that there are many versions.
I need # vtk DataFile Version 3.0 but this code gives me # vtk DataFile Version 4.2.

import vtk
import sys

reader = vtk.vtkNIFTIImageReader()
reader.SetFileName(sys.argv[1])
reader.Update()
print (reader)

contour=vtk.vtkMarchingCubes()  
contour.SetInputData(reader.GetOutput())
contour.ComputeNormalsOn()
contour.ComputeGradientsOn()
contour.SetValue(0,0.1)
contour.Update()
 
# Write in vtk
triangle = vtk.vtkTriangleFilter()
triangle.SetInputConnection(contour.GetOutputPort())
triangle.PassVertsOff()
triangle.PassLinesOff()
 
decimation=vtk.vtkQuadricDecimation()
decimation.SetInputConnection(triangle.GetOutputPort())
 
clean=vtk.vtkCleanPolyData()
clean.SetInputConnection(triangle.GetOutputPort())
 
triangle2 = vtk.vtkTriangleFilter()
triangle2.SetInputConnection(clean.GetOutputPort())
triangle2.PassVertsOff()
triangle2.PassLinesOff()

#save .vtk polydata
writer = vtk.vtkPolyDataWriter()
writer.SetFileTypeToASCII()
writer.SetInputConnection(contour.GetOutputPort())
writer.SetFileName("1.vtk")
writer.Write()

what I get after runnig this code :
80367805_557148228180036_6815696929305919488_n

what I need

80358453_747858695691280_844619938827075584_n

could someone help me

A sure way is to use a very old version of VTK, which writes DataFile Version 3.0.

For basic features (like simple geometry), the files format versions 3.0 and 4.2 might be identical, so just changing the comment in the first line using a text editor could be enough.

There might be a way to force VTK to write the older version of the format. To find out, ask on the VTK forum.

I’d guess with a basic ASCII PolyData mesh, you can just edit the header with a text editor to change the 4.2 to 3.0.

no if you have noticed : the 4.2 file has 9 numbers as points but the other one 3.0 has only 3 which I have this error <<Details: cannot copy sequence with size 9 to array axis with dimension 3 >> when I want to display the image.
Did you understand me ??