open-discussion
open-discussion > RE: New analysis tool release and other questions
May 10, 2016 01:05 PM | Beatriz Paniagua
RE: New analysis tool release and other questions
Hi Lucas,
Happy my previous response was helpful.
Yes, it could. If you change the orientation of the parameterization that will result in different spatial orientation of the meshes, since the 3D points will be sampled from a parameterization with different orientation.
2) Using the generated *para.vtk and *surf.vtk files for computing a *surfSPHARM.vtk file while changing the spatial alignment of the bad aligned meshes with ParaToSPHARMMesh.
Yes, this is a good idea. You will have to QC the different orientations to see which one fits the current template. In your first run of spharm I am assuming this will be the first mesh. A script like this can be run in a unix terminal to generate all possible flips for each missaligned case. If you dont want things to go crazy and have a lot of files generated, I suggest creating a directory and generating links or copying the surf.vtk and para.vtk files of the flipped cases there before running the script.
A script like this will generate different versions of each missaligned cases you will have to tease out. The flag that enforces a certain alignment in the parameterization is FinalFlip.
Then, you will have to load the surfSPHARM mesh and the Phi.txt and Theta.txt files. You can do that with MeshMath, using the KWMtoPolyData flag.
MeshMath input.vtk outputwithScalars.vtk -KWMtoPolyData Phicolor.txt name_of_scalar_field_your_choice
3) Computing a mean template with MeshMath
Once you have all your meshes aligned well, I dont see why you
should do this. You can do it and it might result into something
more fine tuned, but you might have to go through the whole
flipScript process again. You see, the flips happen because there
is sometimes pathology that affects the shape and modifies what the
program thinks its the first automatic alignment. I give you an
example, we had a lateral ventricle analysis study in which some of
the LVs were very very thin due to pathology in the front, and the
program detected the long axis ok, but thought the pathologic
fronts were tails, and hence aligned the shapes incorrectly. That
is why we have the option to do the 3 axis flips (8 flips total)
and select what is best.
4) Running the outcomes of 2) with 3) through ParaToSPHARMMesh
Again, this will not be necessary when you have gone through 1) and 2) as suggested.
I hope that helps.
Best,
Beatriz
Happy my previous response was helpful.
Albeit on a second thought, changing the
orientation of the parametrization could probably get the meshes
which are misaligned of about 180 degrees in the right spatial
position, could'nt it?
Yes, it could. If you change the orientation of the parameterization that will result in different spatial orientation of the meshes, since the 3D points will be sampled from a parameterization with different orientation.
1) Computing a complete set of files with the 3D
Slicer application by using the mean template and procrustes
options; identifying bad aligned meshes in the viewer.
Yes, perfect.2) Using the generated *para.vtk and *surf.vtk files for computing a *surfSPHARM.vtk file while changing the spatial alignment of the bad aligned meshes with ParaToSPHARMMesh.
Yes, this is a good idea. You will have to QC the different orientations to see which one fits the current template. In your first run of spharm I am assuming this will be the first mesh. A script like this can be run in a unix terminal to generate all possible flips for each missaligned case. If you dont want things to go crazy and have a lot of files generated, I suggest creating a directory and generating links or copying the surf.vtk and para.vtk files of the flipped cases there before running the script.
#!/bin/tcsh -f
foreach i (/pathtoGenParaMeshRESULTS/subjectID_pp_surf.vtk)
set j = $i:s/_surf.vtk/_para.vtk/
set out00 = $i:s/pp_surf.vtk/pp0_surf/
set out01 = $i:s/pp_surf.vtk/pp1_surf/
set out02 = $i:s/pp_surf.vtk/pp2_surf/
set out03 = $i:s/pp_surf.vtk/pp3_surf/
set out04 = $i:s/pp_surf.vtk/pp4_surf/
set out05 = $i:s/pp_surf.vtk/pp5_surf/
set out06 = $i:s/pp_surf.vtk/pp6_surf/
set out07 = $i:s/pp_surf.vtk/pp7_surf/
ParaToSPHARMMeshCLP $j $i $out00 --regTemplateFileOn --regTemplate /pathtotemplate/templateID_pp_surfSPHARM.vtk --flipTemplateOn --flipTemplate /pathtotemplate/templateID_pp_surfSPHARM.coef --subdivLevel 20 --spharmDegree 16 --FinalFlip 0 --paraOut --medialMesh
ParaToSPHARMMeshCLP $j $i $out01 --regTemplateFileOn --regTemplate /pathtotemplate/templateID_pp_surfSPHARM.vtk --flipTemplateOn --flipTemplate /pathtotemplate/templateID_pp_surfSPHARM.coef --subdivLevel 20 --spharmDegree 16 --FinalFlip 1 --paraOut --medialMesh
ParaToSPHARMMeshCLP $j $i $out02 --regTemplateFileOn --regTemplate /pathtotemplate/templateID_pp_surfSPHARM.vtk --flipTemplateOn --flipTemplate /pathtotemplate/templateID_pp_surfSPHARM.coef --subdivLevel 20 --spharmDegree 16 --FinalFlip 2 --paraOut --medialMesh
ParaToSPHARMMeshCLP $j $i $out03 --regTemplateFileOn --regTemplate /pathtotemplate/templateID_pp_surfSPHARM.vtk --flipTemplateOn --flipTemplate /pathtotemplate/templateID_pp_surfSPHARM.coef --subdivLevel 20 --spharmDegree 16 --FinalFlip 3 --paraOut --medialMesh
ParaToSPHARMMeshCLP $j $i $out04 --regTemplateFileOn --regTemplate /pathtotemplate/templateID_pp_surfSPHARM.vtk --flipTemplateOn --flipTemplate /pathtotemplate/templateID_pp_surfSPHARM.coef --subdivLevel 20 --spharmDegree 16 --FinalFlip 4 --paraOut --medialMesh
ParaToSPHARMMeshCLP $j $i $out05 --regTemplateFileOn --regTemplate /pathtotemplate/templateID_pp_surfSPHARM.vtk --flipTemplateOn --flipTemplate /pathtotemplate/templateID_pp_surfSPHARM.coef --subdivLevel 20 --spharmDegree 16 --FinalFlip 5 --paraOut --medialMesh
ParaToSPHARMMeshCLP $j $i $out06 --regTemplateFileOn --regTemplate /pathtotemplate/templateID_pp_surfSPHARM.vtk --flipTemplateOn --flipTemplate /pathtotemplate/templateID_pp_surfSPHARM.coef --subdivLevel 20 --spharmDegree 16 --FinalFlip 6 --paraOut --medialMesh
ParaToSPHARMMeshCLP $j $i $out07 --regTemplateFileOn --regTemplate /pathtotemplate/templateID_pp_surfSPHARM.vtk --flipTemplateOn --flipTemplate /pathtotemplate/templateID_pp_surfSPHARM.coef --subdivLevel 20 --spharmDegree 16 --FinalFlip 7 --paraOut --medialMesh
end
foreach i (/pathtoGenParaMeshRESULTS/subjectID_pp_surf.vtk)
set j = $i:s/_surf.vtk/_para.vtk/
set out00 = $i:s/pp_surf.vtk/pp0_surf/
set out01 = $i:s/pp_surf.vtk/pp1_surf/
set out02 = $i:s/pp_surf.vtk/pp2_surf/
set out03 = $i:s/pp_surf.vtk/pp3_surf/
set out04 = $i:s/pp_surf.vtk/pp4_surf/
set out05 = $i:s/pp_surf.vtk/pp5_surf/
set out06 = $i:s/pp_surf.vtk/pp6_surf/
set out07 = $i:s/pp_surf.vtk/pp7_surf/
ParaToSPHARMMeshCLP $j $i $out00 --regTemplateFileOn --regTemplate /pathtotemplate/templateID_pp_surfSPHARM.vtk --flipTemplateOn --flipTemplate /pathtotemplate/templateID_pp_surfSPHARM.coef --subdivLevel 20 --spharmDegree 16 --FinalFlip 0 --paraOut --medialMesh
ParaToSPHARMMeshCLP $j $i $out01 --regTemplateFileOn --regTemplate /pathtotemplate/templateID_pp_surfSPHARM.vtk --flipTemplateOn --flipTemplate /pathtotemplate/templateID_pp_surfSPHARM.coef --subdivLevel 20 --spharmDegree 16 --FinalFlip 1 --paraOut --medialMesh
ParaToSPHARMMeshCLP $j $i $out02 --regTemplateFileOn --regTemplate /pathtotemplate/templateID_pp_surfSPHARM.vtk --flipTemplateOn --flipTemplate /pathtotemplate/templateID_pp_surfSPHARM.coef --subdivLevel 20 --spharmDegree 16 --FinalFlip 2 --paraOut --medialMesh
ParaToSPHARMMeshCLP $j $i $out03 --regTemplateFileOn --regTemplate /pathtotemplate/templateID_pp_surfSPHARM.vtk --flipTemplateOn --flipTemplate /pathtotemplate/templateID_pp_surfSPHARM.coef --subdivLevel 20 --spharmDegree 16 --FinalFlip 3 --paraOut --medialMesh
ParaToSPHARMMeshCLP $j $i $out04 --regTemplateFileOn --regTemplate /pathtotemplate/templateID_pp_surfSPHARM.vtk --flipTemplateOn --flipTemplate /pathtotemplate/templateID_pp_surfSPHARM.coef --subdivLevel 20 --spharmDegree 16 --FinalFlip 4 --paraOut --medialMesh
ParaToSPHARMMeshCLP $j $i $out05 --regTemplateFileOn --regTemplate /pathtotemplate/templateID_pp_surfSPHARM.vtk --flipTemplateOn --flipTemplate /pathtotemplate/templateID_pp_surfSPHARM.coef --subdivLevel 20 --spharmDegree 16 --FinalFlip 5 --paraOut --medialMesh
ParaToSPHARMMeshCLP $j $i $out06 --regTemplateFileOn --regTemplate /pathtotemplate/templateID_pp_surfSPHARM.vtk --flipTemplateOn --flipTemplate /pathtotemplate/templateID_pp_surfSPHARM.coef --subdivLevel 20 --spharmDegree 16 --FinalFlip 6 --paraOut --medialMesh
ParaToSPHARMMeshCLP $j $i $out07 --regTemplateFileOn --regTemplate /pathtotemplate/templateID_pp_surfSPHARM.vtk --flipTemplateOn --flipTemplate /pathtotemplate/templateID_pp_surfSPHARM.coef --subdivLevel 20 --spharmDegree 16 --FinalFlip 7 --paraOut --medialMesh
end
A script like this will generate different versions of each missaligned cases you will have to tease out. The flag that enforces a certain alignment in the parameterization is FinalFlip.
Then, you will have to load the surfSPHARM mesh and the Phi.txt and Theta.txt files. You can do that with MeshMath, using the KWMtoPolyData flag.
MeshMath input.vtk outputwithScalars.vtk -KWMtoPolyData Phicolor.txt name_of_scalar_field_your_choice
3) Computing a mean template with MeshMath
4) Running the outcomes of 2) with 3) through ParaToSPHARMMesh
Again, this will not be necessary when you have gone through 1) and 2) as suggested.
I hope that helps.
Best,
Beatriz
Threaded View
Title | Author | Date |
---|---|---|
Lucas Fenger | May 4, 2016 | |
Lucas Fenger | May 12, 2016 | |
Beatriz Paniagua | May 5, 2016 | |
Lucas Fenger | May 6, 2016 | |
Beatriz Paniagua | May 10, 2016 | |