Maverick/View Virtual Family Together: Difference between revisions

From KitwarePublic
Jump to navigationJump to search
Line 8: Line 8:
This produces representations in the .mhd format.   
This produces representations in the .mhd format.   


One wacky thing, the man is imaged head-first while the woman is imaged feet-first.  This can be made consistent by adding orientation information to the woman's header file.
One wacky thing, the man is imaged head-first while the woman is imaged feet-first.  This can be made consistent by adding an orientation matrix to the woman's header file.


  vi Ella.mhd
  vi Ella.mhd


Add the line before the last line of the file.
Add the line below so that it appears before the last line of the file.


  Orientation = 1 0 0 0 1 0 0 0 -1
  Orientation = 1 0 0 0 1 0 0 0 -1


The final -1 causes the z-axis to be flipped.  The new Ella.mhd should look like this:
This Orientation field is specifying a transform matrix for the data.  It must be a 3x3 matrix.  It can be used to swap right/left and front/back and (shown) top/bottom and to permute the axis (e.g., swap x-axis and y-axis) of the data.  In this case, the final -1 causes the z-axis to be flipped.  The new Ella.mhd should look like this:


  NDims = 3
  NDims = 3

Revision as of 09:07, 7 October 2008

Create a scene using the virtual family

First convert two members of the virtual family

VirtualFamilyTxtToMhdCsv Duke_34y_v5_2mm.txt Duke_34y_v5_2mm.raw Duke.mhd Duke.csv
VirtualFamilyTxtToMhdCsv Ella_26y_v2_2mm.txt Ella_26y_v2_2mm.raw Ella.mhd Ella.csv

This produces representations in the .mhd format.

One wacky thing, the man is imaged head-first while the woman is imaged feet-first. This can be made consistent by adding an orientation matrix to the woman's header file.

vi Ella.mhd

Add the line below so that it appears before the last line of the file.

Orientation = 1 0 0 0 1 0 0 0 -1

This Orientation field is specifying a transform matrix for the data. It must be a 3x3 matrix. It can be used to swap right/left and front/back and (shown) top/bottom and to permute the axis (e.g., swap x-axis and y-axis) of the data. In this case, the final -1 causes the z-axis to be flipped. The new Ella.mhd should look like this:

NDims = 3
DimSize = 265 150 840
HeaderSize = -1
ElementType = MET_UCHAR
ElementByteOrderMSB = True
ElementSpacing = 2 2 2
Orientation = 1 0 0 0 1 0 0 0 -1
ElementDataFile = Ella_26y_V2_2mm.raw

The current release of Maverick, however, requires the images to be in the .mha format. So, perform the conversion using imageMath

imageMath Duke.mhd -W 3 Duke.mha
imageMath Ella.mhd -W 3 Ella.mha

Now Merlin can be used to create a scene containing these labelmaps and indexed via those .csv files. Use the standard labelmap import process of Merlin to achieve this.

Create a new version of the woman that is shaped somewhat like the man

To simulate different size people, the virtual woman (Ella) can be registered with the virtual man (Duke) using a deformable (BSpline) transform. In this manner, the woman will take on aspects of the shape of the man. The RegisterImages module accomplishes this

RegisterImages Duke.mha Ella.mha 
   --registration PipelineBSpline --interpolation NearestNeighbor 
   --minimizeMemory --controlPointSpacing 100 --bsplineSamplingRatio 0.02
   --resampledImage TallElla.mha --saveTransform TallElla.tfm

All of the above should be on one line. Processing time will vary from 30 minutes to 1 hour, depending on the PC. The result should be two new files: TallElla.mha and TallElla.tfm

The TallElla.mha file can be imported into Merlin.

You can control how closely the woman is deformed into the man by controlling how many BSpline control points are used. More points means more flexibility and ultimately a closer match. The two relevant command-line arguments are --controlPointSpacing and --bsplineSamplingRatio. A smaller controlPointSpacing value means that more bspline control points will be used to span the image. When more control points are used, more samples should be taken to evaluate the metric, i.e., the bsplineSamplingRatio should be increased. Note that computation time can quickly become multiple hours.

View the short and tall Ella next to one another in the same volume

First move TellElla 500 mm to the right by editing the file TallElla.mha using vi or another text editor.

vi TallElla.mha

Change line containing the keyword Offset to induce the shift

Offset =