Problem with DOLFIN XML data

Hi everyone,
I am first using fenics in an attempt to simulate the evolution of a tumor. Hoping to have carried out all the installation steps of fenics (and dolfin) correctly, I am having problems trying to get the right .xml and .pvd files respectively for the execution of the diffusion simulation and for the visualization with paraview.
In particular, from such commands ( is the code that should produce the indicated outputs) I get the following output:

(fenicsproject) MAC-2:Pre-simulation lorenzomarta$ python3 
Traceback (most recent call last):
  File "/Users/lorenzomarta/Desktop/Pre-simulation/", line 9, in <module>
    mvc_Dxx = MeshValueCollection("double", mesh, "meshDxx.xml")
  File "/Applications/anaconda3/envs/fenicsproject/lib/python3.10/site-packages/dolfin/mesh/", line 16, in __new__
    return mvc(mesh, dim)

*** -------------------------------------------------------------------------
*** DOLFIN encountered an error. If you are not able to resolve this issue
*** using the information listed below, you can ask for help at
*** Remember to include the error message listed below and, if possible,
*** include a *minimal* running example to reproduce the error.
*** -------------------------------------------------------------------------
*** Error:   Unable to read DOLFIN XML data.
*** Reason:  Unable to find tag <mesh_value_collection>.
*** Where:   This error was encountered inside xmlutils.cpp.
*** Process: 0
*** DOLFIN version: 2019.1.0
*** Git changeset:  
*** -------------------------------------------------------------------------

How can I proceed? I cannot understand the nature of the error. Could it depend on the right directory or not? How can I check if I am in the right ambient?

Without a minimal example to reprduce your issue, it is hard to give you any guidance.
As the error says, it cannot find any MeshValueCollection inside meshDxx.xml.
How did you generate meshDxx.xml? How does the file look like?

I generated meshDxx.xml starting from Dxx.nii.gz obtain by software Anima, after that I converted that file to the .mhd format:
vmtk vmtkimagewriter -ifile Dij.nii.gz -ofile Dij.mhd.
Subsequently, with the command:
vmtk myvmtkmeshDlabeling -ifile meshR.vtu -diffusionmapfile Dxx.mhd -diffusionarray "Dxx_labels" -ofile meshDxx.vtu
I got the meshDxx.vtu file which takes into account both the mesh of the brain in my possession (meshR.vtu) and a DTI component.
At the end I converted the obtained file into .xml format:
vmtk myvmtkmeshwriter -ifile meshDxx.vtu -ofile meshDxx.xml

The file looks like this:

<?xml version="1.0"?>
<dolfin xmlns:dolfin="">
  <mesh celltype="tetrahedron" dim="3">
    <vertices size="57027">
      <vertex index="0" x="-4.17037" y="-66.7374" z="-64.476" />
      <vertex index="1" x="-35.1337" y="-97.6006" z="-18.8778" />
      <vertex index="2" x="46.0256" y="-66.9107" z="45.0281" />
      <vertex index="3" x="-62.4098" y="4.49696" z="-14.0501" />
      <vertex index="4" x="-12.4572" y="-91.4797" z="-36.6194" />
      <vertex index="5" x="-52.019" y="21.4306" z="45.2711" />
      <vertex index="6" x="42.7979" y="-85.0831" z="17.6536" />
      <vertex index="7" x="-14.3479" y="-62.4588" z="-66.9697" />
      <vertex index="8" x="-46.7237" y="-3.91732" z="-50.3585" />
      <vertex index="9" x="-74.3446" y="-36.5559" z="-11.5342" />

So what comes after all the vertices? are there any tags to read in?

      <vertex index="57024" x="20.1637" y="-32.1744" z="40.4529" />
      <vertex index="57025" x="20.3737" y="-32.8761" z="39.9354" />
      <vertex index="57026" x="21.0171" y="-33.3729" z="39.3762" />
    <cells size="351965">
      <tetrahedron index="0" v0="5515" v1="9501" v2="9689" v3="12526" />
      <tetrahedron index="1" v0="2536" v1="3364" v2="4092" v3="5052" />
      <tetrahedron index="2" v0="2988" v1="4004" v2="4339" v3="5673" />
      <tetrahedron index="3" v0="14537" v1="25740" v2="27198" v3="34402" />
      <tetrahedron index="4" v0="3737" v1="24932" v2="25610" v3="34228" />
      <tetrahedron index="5" v0="7426" v1="9451" v2="12453" v3="12454" />
      <tetrahedron index="6" v0="2151" v1="6822" v2="7108" v3="7879" />
      <tetrahedron index="7" v0="3160" v1="4238" v2="5061" v3="5738" />
  <tetrahedron index="351963" v0="5852" v1="27108" v2="55007" v3="57026" />
      <tetrahedron index="351964" v0="27108" v1="55007" v2="57025" v3="57026" />

I do not find any tags.

Thats the reason for your error message then. I do not know the conversion tools you are using. Im usually using meshio which has been covered in many posts on this forum.

So, are you suggesting to change the way to convert files starting from .vtu files to .xml files?
I did not understand if I have to do a further conversion from file to .xml to another format or if I have to get the .xml file starting from the .vtu file available through another conversion.

Somewhere along the likes of converting your mesh into different formats, you are losing the information about your tags. You need to figure out which step this happens in, and replace that step with a step that can transfer this information.

Ok, now it’s clearer, thanks.
Last thing: the final format needed to work with fenics is .xml?
Could you send me an example of a tags that should be present in the files?

The format can be xml or xdmf. XDMF is preferrable, as it is more suitable for parallel computations.
See for instance: What is wrong with my mesh? - #8 by dokken
where you would have to change cell_data = mesh.get_cell_data("gmsh:physical", cell_type)
to get the tag from the file read in with meshio.

In general, what file format do you start from? Because I have files of type .nii.gz available

Im not familiar with that format. I would suggest trying to read in the vtu files with meshio and see what data is in them