Some parts of image analysis, like drawing the lines, have been done in 305 space. This means that each subject's brain has been scaled and realigned to match an average brain created from 305 individuals. This scaling allows us to make object models more easily and gives us a standard view of the brain on which our protocols depend. However, to look at difference in brain size between subjects, we want to undo this scaling. By inverting the transformation that put subjects into 305 space (the .air file), we can put subjects back into reslice space, in which the brain is its native size. Since reliability has never been assessed on the tag points used to put brains into reslice space, we will use the first and last points of each sulcal line (on which reliability has been assessed) to put subjects into a common orientation while retaining the native size and shape of the brain. Lines, objects, and the binary gray minc must go through exactly the same transformations so that they match perfectly in the end. A copy of the scripts used to do this lives in /loni/edevel/bin/SULCAL_SPACE. This process will only work if the volume that was aligned to the 305 brain (the reslice volume) has step sizes of 1 in all dimensions.
The data obtained from Yale were flipped (anatomical left was on the right side of the scan and vice versa), so a separate directory (/loni/edevel/bin/SULCAL_SPACE/YALE_SULCAL_SPACE) contains scripts that have been modified to correct this. Differences between the process for flipped and non-flipped conversion will be in blue.
When the medial surface is analyzed, the right hemisphere must be flipped so that it can be treated exactly like the left hemisphere. The first step in the conversion process, then, is to flip the lines and objects into the right hemisphere's space so they are converted correctly, and the last step is to flip them back into the left hemisphere's space for analysis. Scripts used to do this and a text file explaining the process live in /loni/edevel/bin/SULCAL_SPACE/HEMISPHERES. Also, the first and last points of the medial lines can be used to reorient subjects as well as the first and last points of the lateral lines, so different versions of scripts 4, 5, and 6 are included in the directory. Differences between the process for medial and lateral conversion will be in purple.
Before any transformations are applied to the medial lines, the lines for the right hemisphere must be flipped back into the right hemisphere's space so that the transformation exactly undoes the conversion that was done. The script 0_reflect_lines.csh will flip the right lines.
1) The script 1_invert_converter.csh will turn the air file that was used to move the files from reslice space to 305 space into an xfm. The air file applies only to volumes, but the xfm can be applied to objects as well. The results of applying an air file and an xfm with the same values will be exactly opposite - if the air file increases size, an xfm with the same values will decrease size. Therefore, the xfm that will undo the scaling (convert from 305 space to reslice space) will use the same numbers as the air file that scaled it originally.
2) In order for the xfms to be understood by the program, they must be edited. The bracket at the beginning of the first line of numbers must be removed and a semi-colon at the end of the last line of numbers must be added.
3) The origin differs in different file formats (.img and .mnc), so when the minc is converted into an img to apply the air file and when it is converted back, some shifting occurs that must be undone. There are standard xfms that account for this difference (minc_img.xfm, reslice_img_mnc.xfm, and shift.xfm). When these are combined with the xfm edited in step 2, one xfm is created which takes volumes and objects from 305 minc space to reslice minc space in one step, minimizing the amount of resampling that has to be done. The script 2_concat_xfm.csh combines the xfms to create that transformation for each subject, called subjectnumber_original_305_to_reslice.xfm.
4) The script 3_convert_objects_to_reslice.csh converts the sulcal lines that were drawn and the colored object on which they were drawn from 305 space to reslice space using the xfm created in step 3. The object should match the reslice volume that was created by resampling the original data using the tag points and the lines should fall onto the object following the same sulci they were originally drawn to follow.
The script 3_convert_and_flip_lines.csh converts the lines and object model from 305 space to reslice space using the xfm created in step 3. It then flips the lines and object and renames them so that left lines reflect left anatomy and fall on the left side of the screen and right lines reflect right anatomy and fall on the right side of the screen.
5) 4_analyze.csh transforms the lines from obj format into ucf format, reslices them into an equal number of points, and calculates the average position of the lines and variability around that average. The starting and end points of each individual's lines and the average lines will be taken from these files. To run this script, type 4_analyze.csh followed by the name of the directory containing all the line objs in resliced space.
4_analyze_hem.csh includes the medial lines in the averaging.
6) 5_create_avg_tags.csh turns the first and last points of the average lines into a tag file. The tag file must then be edited to add a space at the end of each line with numbers in it or the xfm can not be created correctly. The file /loni/edevel/bin/SULCAL_SPACE/all_reslice_avg_YALE_176_sulcal_landmarks.tag is the tag file containing the average first and last points of the lateral lines from the Yale project (176 normal individual aged 7 to 87) and has been used in place of a project average for several projects.
5_create_avg_tag_hem.csh includes the medial lines in the tag file. The file /loni/edevel/bin/SULCAL_SPACE/HEMISPHERES/all_reslice_avg_YALE_176_medsulcal_landmarks.tag has the average first and last points of the lateral and medial lines from the Yale project and can be used in place of a project average.
7) 6_create_tags.csh turns the starting and end points of each subject's sulcal lines into a tag file and combines them with the average tag file created in step 6. The result in a file containing two columns of coordinates (the average and the individual's points) which represent matching anatomy.
6_create_tags_hem.csh includes the medial lines in the tag file for each individual.
8) The tag file created in step 7 must be opened in register and an xfm aligning the points must be created.
register subjectnumber_all_sulcal_landmarks.tag
The cells in the bottom left boxes should
have numbers (the coordinates) in them.
Type the name of the transformation (subjectnumber_reslice_to_avg_PROJECT_NAME_sulcal.xfm)
into the lower empty white box (just above the "Record Tag" button) and
hit Enter.
Click on the empty yellow box just above
the box described above name to save the xfm.
9) 7_sulcal_reorientation.csh uses the xfm created by step 8 to transform the reslice objects created in step 4 into sulcal space. The lines and objects in sulcal space can be used in flatmapping and cortical surface analysis.
7_sulcal_reorientation_hem.csh uses the xfm that was created by including medial lines.
The last step for the hemisphere conversion is to flip the right lines back over into the left hemisphere's space using 8_reflect_lines_back.csh. These flipped lines and objects can them be used in medial flatmapping and cortical surface analysis.
10) A binary gray minc ( with tissue inside the brain mask that segments as gray matter given a signal value of 1, everything else 0) in sulcal space will have to be created for gray matter analysis. The script binary_gray_sulcal.csh will create these mincs. The image that was segmented after the brain was rf corrected and skull stripped will be turned into a binary gray image (everything that is gray matter inside the brain will be a 1, everything else a 0). The binary grey image is then put into 305 space and clamped (resampling creates voxels with signal values between 0 and 1). The clamped 305 gray only mnc is put back into reslice space via the same transformations that the surface underwent and clamped again. The converted reslice gray only minc is put into sulcal space using the xfm created in step 8 and clamped a final time. This final minc should match the object model in sulcal space.
The script binary_gray_sulcal_hem.csh creates binary gray images in sulcal space for each hemisphere and flips the right hemisphere's volume. The image that was segmented after the brain was rf corrected and skull stripped will be turned into a binary gray image. The segmented image is divided into left and right hemispheres using the hemisphere masks created in reslice space. The binary gray image for each hemisphere is put into 305 space and clamped. The clamped 305 gray only mincs are put back into reslice space via the same transformation that the surface underwent, then clamped again. The clamped converted reslice gray only mincs are put into sulcal space and clamped. The right hemisphere is flipped.
The script
binary_gray_sulcal_flip.csh creates binary gray images in reslice space,
flips them, and converts them to sulcal space. First, the image that
was segmented after the brain was rf corrected and skull stripped will
be turned into a binary gray image. The binary grey image is put
into flipped 305 space and clamped. The clamped flipped 305 binary gray
minc is put back into flipped reslice space via the same transformations
that the surface underwent, flipped, and clamped again. The
clamped converted reslice gray only minc is put into sulcal space and clamped.