Maverick/View Virtual Family Together: Difference between revisions

From KitwarePublic
Jump to navigationJump to search
Line 34: Line 34:
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.
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 as tall as the man =
= Create a new version of the woman that is shaped like the man =


To simulate different size people, the virtual woman (Ella) can be registered with the virtual man (Duke).  The RegisterImages module accomplishes this
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  
  RegisterImages Duke.mha Ella.mha  
     --registration PipelineAffine --interpolation NearestNeighbor  
     --registration PipelineBSpline --interpolation NearestNeighbor  
    --minimizeMemory --controlPointSpacing 75
     --resampledImage TallElla.mha --saveTransform TallElla.tfm
     --resampledImage TallElla.mha --saveTransform TallElla.tfm


All of the above should be on one line.
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
 
Processing time will vary from 5 minutes to 30 minutes, 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.
The TallElla.mha file can be imported into Merlin.


The TallElla.tfm file defines an Affine transform consisting of a matrix and an offset. The file should look something like this:
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.   The command-line argument specifies the control-point spacing, so larger spacing means fewer control points.
 
#Insight Transform File V1.0
# Transform 0
Transform: AffineTransform_double_3_3
Parameters: 0.870992 -0.0224575 -0.0878403
            0.0659526 0.83837 -0.050303
            0.0122104 -0.0274275 0.726458 
            -46.4034 -4.29241 -148.693
FixedParameters: 264 150 840


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

Revision as of 03:47, 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 orientation information to the woman's header file.

vi Ella.mhd

Add the line before the last line of the file.

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:

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 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 75
   --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. The command-line argument specifies the control-point spacing, so larger spacing means fewer control points.

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 =