From 498706fb662a0af8ad431f297d8e2fd548fcca56 Mon Sep 17 00:00:00 2001 From: Daniel Bullock Date: Sat, 7 Dec 2019 18:13:30 -0500 Subject: [PATCH 1/3] sorted functions into directory structure --- ConnectomeTestQ_v2.m => Analysis/ConnectomeTestQ_v2.m | 0 bsc_csvTables2DataStruc.m => Analysis/bsc_csvTables2DataStruc.m | 0 bsc_feAndSegQualityCheck.m => Analysis/bsc_feAndSegQualityCheck.m | 0 .../bsc_normalizeStatMeasures_pathsVersion_v2.m | 0 .../bsc_plotTractZscoreMeasures_pathsVersion.m | 0 .../bsc_plotZscoreMeasuresFromCSV.m | 0 .../bsc_saveTrackCheckList_pathsVersion.m | 0 .../bsc_saveTrackCheckList_pathsVersion_v2.m | 0 .../bsc_streamlineGeometryPriors.m | 0 bsc_tableAverages.m => Analysis/bsc_tableAverages.m | 0 bsc_tableAverages_v3.m => Analysis/bsc_tableAverages_v3.m | 0 .../deprecated/bsc_normalizeStatMeasures_pathsVersion.m | 0 wma_endpointMapsDecay_v5.m => Analysis/wma_endpointMapsDecay_v5.m | 0 wma_quantAllWMNorm.m => Analysis/wma_quantAllWMNorm.m | 0 wma_quantTract.m => Analysis/wma_quantTract.m | 0 wma_quantWBFG.m => Analysis/wma_quantWBFG.m | 0 bsc_inflateLabels.m => Atlas_tools/bsc_inflateLabels.m | 0 bsc_inflateLabels_v2.m => Atlas_tools/bsc_inflateLabels_v2.m | 0 fnDeislandLabels_v2.m => Atlas_tools/fnDeislandLabels_v2.m | 0 wma_getAsegFile.m => Atlas_tools/wma_getAsegFile.m | 0 .../Formatters/wma_formatForBrainLife.m | 0 .../Formatters/wma_formatForBrainLife_v2.m | 0 .../bsc_GenROIfromPairStringList_BL.m | 0 .../bsc_GenROIfromPairStringList_v2_BL.m | 0 .../bsc_SegROIfromPairStringList_BL.m | 0 .../bsc_SegROIfromPairStringList_v2_BL.m | 0 .../bsc_classifiedStreamEndpointCortex_BL.m | 0 .../bsc_feAndSegQualityCheck_BL.m | 0 .../bsc_feAndSegQualityCheck_BL_v2.m | 0 bsc_groupTractPlots_BL.m => BL_Wrappers/bsc_groupTractPlots_BL.m | 0 .../bsc_streamlineCategoryPriors_BL.m | 0 .../bsc_concatClassificationCriteria.m | 0 .../bsc_extractClassification.m | 0 .../bsc_extractStreamIndByName.m | 0 .../bsc_makeFGsFromClassification_v4.m | 0 .../bsc_makeWBFGandClassFromList.m | 0 .../bsc_mergeFGandClass.m | 0 .../bsc_reconcileClassifications.m | 0 .../bsc_spliceClassifications.m | 0 .../classificationFromMultiTCK.m | 0 .../deprecated/bsc_makeFGsFromClassification.m | 0 .../deprecated/bsc_makeFGsFromClassification_v2.m | 0 .../deprecated/bsc_makeFGsFromClassification_v3.m | 0 .../removeOutliersClassification.m | 0 .../wma_classificationStrucGrouping.m | 0 .../wma_clearNonvalidClassifications.m | 0 .../wma_resortClassificationStruc.m | 0 bsc_plotEndpointsOnFG.m => Debug_Tools/bsc_plotEndpointsOnFG.m | 0 bsc_quickPlot.m => Debug_Tools/bsc_quickPlot.m | 0 .../Deprecated/bsc_atlasROINumsFromCoords.m | 0 .../Deprecated/bsc_atlasROINumsFromCoordsInterp.m | 0 .../Deprecated/bsc_atlasROINumsFromCoords_v2.m | 0 bsc_makePlanarROI.m => ROI_Tools/Deprecated/bsc_makePlanarROI.m | 0 .../Deprecated/bsc_niftiROIFromAtlasNums.m | 0 bsc_planeFromROI.m => ROI_Tools/Deprecated/bsc_planeFromROI.m | 0 bsc_roiFromFSnums.m => ROI_Tools/Deprecated/bsc_roiFromFSnums.m | 0 .../Deprecated/wma_roiFromAtlasNum.m | 0 wma_roiFromFSnums.m => ROI_Tools/Deprecated/wma_roiFromFSnums.m | 0 bsc_MultiIntersectROIs.m => ROI_Tools/bsc_MultiIntersectROIs.m | 0 .../bsc_atlasROINumsFromCoords_v3.m | 0 .../bsc_endpointAtlasCriteria.m | 0 bsc_intersectROIs.m => ROI_Tools/bsc_intersectROIs.m | 0 bsc_loadAndParseROI.m => ROI_Tools/bsc_loadAndParseROI.m | 0 bsc_makePlanarROI_v2.m => ROI_Tools/bsc_makePlanarROI_v2.m | 0 bsc_mergeROIs.m => ROI_Tools/bsc_mergeROIs.m | 0 bsc_midpointROISegment.m => ROI_Tools/bsc_midpointROISegment.m | 0 bsc_modifyROI_v2.m => ROI_Tools/bsc_modifyROI_v2.m | 0 bsc_planeFromROI_v2.m => ROI_Tools/bsc_planeFromROI_v2.m | 0 bsc_roiFromAtlasNums.m => ROI_Tools/bsc_roiFromAtlasNums.m | 0 bsc_shiftROI.m => ROI_Tools/bsc_shiftROI.m | 0 .../bsc_sliceAmalgumROIatCoords.m | 0 bsc_subtractROIs.m => ROI_Tools/bsc_subtractROIs.m | 0 bsc_tractByEndpointROIs.m => ROI_Tools/bsc_tractByEndpointROIs.m | 0 multiROIpairSeg.m => ROI_Tools/multiROIpairSeg.m | 0 .../wma_SegmentFascicleFromConnectome.m | 0 .../wma_multiSliceAmalgumROIatCoords_BL.m | 0 .../Examples/bsc_opticRadiationSeg_V6.m | 0 {Examples => Segmentations/Examples}/bsc_segmentAslant.m | 0 {Examples => Segmentations/Examples}/bsc_segmentMdLF_ILF_v3.m | 0 {Examples => Segmentations/Examples}/bsc_segpArcTPC.m | 0 {Examples => Segmentations/Examples}/wma_segLobes_v2.m | 0 .../bsc_opticRadiationSeg_V7.m | 0 .../bsc_segmentAntPostTracts_v3.m | 0 bsc_segmentAslant.m => Segmentations/bsc_segmentAslant.m | 0 bsc_segmentCST.m => Segmentations/bsc_segmentCST.m | 0 .../bsc_segmentCerebellarTracts_v2.m | 0 .../bsc_segmentCingulum_v3.m | 0 .../bsc_segmentCorpusCallosum_v3.m | 0 .../bsc_segmentMdLF_ILF_v4.m | 0 .../bsc_segmentSubCortical_v2.m | 0 .../bsc_segmentSuperficialFibers.m | 0 bsc_segmentVOF_v4.m => Segmentations/bsc_segmentVOF_v4.m | 0 bsc_segpArcTPC.m => Segmentations/bsc_segpArcTPC.m | 0 .../bsc_streamlineCategoryPriors_v6.m | 0 wma_segLobes_v2.m => Segmentations/wma_segLobes_v2.m | 0 .../bsc_applyEndpointCriteria.m | 0 .../bsc_applyMidpointCriteria.m | 0 .../bsc_classifiedStreamEndpointCortex.m | 0 bsc_investigateTract.m => Stream_Tools/bsc_investigateTract.m | 0 bsc_reorientFiber.m => Stream_Tools/bsc_reorientFiber.m | 0 bsc_reorientStreamline.m => Stream_Tools/bsc_reorientStreamline.m | 0 bsc_splitTractAtPoint.m => Stream_Tools/bsc_splitTractAtPoint.m | 0 endpointClusterProto.m => Stream_Tools/endpointClusterProto.m | 0 .../External/distinguishable_colors.m | 0 fg2Array.m => Utils/External/fg2Array.m | 0 redblue.m => Utils/External/redblue.m | 0 startUniqueParpool.m => Utils/External/startUniqueParpool.m | 0 WMA_seg_ToolkitDummy.m => Utils/GitUtils/WMA_seg_ToolkitDummy.m | 0 .../GitUtils/wma_makeFunctionListTxt.m | 0 wma_makeGitDirTree.m => Utils/GitUtils/wma_makeGitDirTree.m | 0 wma_makeGitUtilityDir.m => Utils/GitUtils/wma_makeGitUtilityDir.m | 0 .../Loaders/bsc_LoadAndParseFiberStructure.m | 0 wma_loadTck.m => Utils/Loaders/wma_loadTck.m | 0 bsc_MBAplotTracts_BL.m => Visualization/bsc_MBAplotTracts_BL.m | 0 .../bsc_plotClassifiedStreamsAdaptive_v2.m | 0 115 files changed, 0 insertions(+), 0 deletions(-) rename ConnectomeTestQ_v2.m => Analysis/ConnectomeTestQ_v2.m (100%) rename bsc_csvTables2DataStruc.m => Analysis/bsc_csvTables2DataStruc.m (100%) rename bsc_feAndSegQualityCheck.m => Analysis/bsc_feAndSegQualityCheck.m (100%) rename bsc_normalizeStatMeasures_pathsVersion_v2.m => Analysis/bsc_normalizeStatMeasures_pathsVersion_v2.m (100%) rename bsc_plotTractZscoreMeasures_pathsVersion.m => Analysis/bsc_plotTractZscoreMeasures_pathsVersion.m (100%) rename bsc_plotZscoreMeasuresFromCSV.m => Analysis/bsc_plotZscoreMeasuresFromCSV.m (100%) rename bsc_saveTrackCheckList_pathsVersion.m => Analysis/bsc_saveTrackCheckList_pathsVersion.m (100%) rename bsc_saveTrackCheckList_pathsVersion_v2.m => Analysis/bsc_saveTrackCheckList_pathsVersion_v2.m (100%) rename bsc_streamlineGeometryPriors.m => Analysis/bsc_streamlineGeometryPriors.m (100%) rename bsc_tableAverages.m => Analysis/bsc_tableAverages.m (100%) rename bsc_tableAverages_v3.m => Analysis/bsc_tableAverages_v3.m (100%) rename bsc_normalizeStatMeasures_pathsVersion.m => Analysis/deprecated/bsc_normalizeStatMeasures_pathsVersion.m (100%) rename wma_endpointMapsDecay_v5.m => Analysis/wma_endpointMapsDecay_v5.m (100%) rename wma_quantAllWMNorm.m => Analysis/wma_quantAllWMNorm.m (100%) rename wma_quantTract.m => Analysis/wma_quantTract.m (100%) rename wma_quantWBFG.m => Analysis/wma_quantWBFG.m (100%) rename bsc_inflateLabels.m => Atlas_tools/bsc_inflateLabels.m (100%) rename bsc_inflateLabels_v2.m => Atlas_tools/bsc_inflateLabels_v2.m (100%) rename fnDeislandLabels_v2.m => Atlas_tools/fnDeislandLabels_v2.m (100%) rename wma_getAsegFile.m => Atlas_tools/wma_getAsegFile.m (100%) rename wma_formatForBrainLife.m => BL_Wrappers/Formatters/wma_formatForBrainLife.m (100%) rename wma_formatForBrainLife_v2.m => BL_Wrappers/Formatters/wma_formatForBrainLife_v2.m (100%) rename bsc_GenROIfromPairStringList_BL.m => BL_Wrappers/bsc_GenROIfromPairStringList_BL.m (100%) rename bsc_GenROIfromPairStringList_v2_BL.m => BL_Wrappers/bsc_GenROIfromPairStringList_v2_BL.m (100%) rename bsc_SegROIfromPairStringList_BL.m => BL_Wrappers/bsc_SegROIfromPairStringList_BL.m (100%) rename bsc_SegROIfromPairStringList_v2_BL.m => BL_Wrappers/bsc_SegROIfromPairStringList_v2_BL.m (100%) rename bsc_classifiedStreamEndpointCortex_BL.m => BL_Wrappers/bsc_classifiedStreamEndpointCortex_BL.m (100%) rename bsc_feAndSegQualityCheck_BL.m => BL_Wrappers/bsc_feAndSegQualityCheck_BL.m (100%) rename bsc_feAndSegQualityCheck_BL_v2.m => BL_Wrappers/bsc_feAndSegQualityCheck_BL_v2.m (100%) rename bsc_groupTractPlots_BL.m => BL_Wrappers/bsc_groupTractPlots_BL.m (100%) rename bsc_streamlineCategoryPriors_BL.m => BL_Wrappers/bsc_streamlineCategoryPriors_BL.m (100%) rename bsc_concatClassificationCriteria.m => ClassificationStruc_Tools/bsc_concatClassificationCriteria.m (100%) rename bsc_extractClassification.m => ClassificationStruc_Tools/bsc_extractClassification.m (100%) rename bsc_extractStreamIndByName.m => ClassificationStruc_Tools/bsc_extractStreamIndByName.m (100%) rename bsc_makeFGsFromClassification_v4.m => ClassificationStruc_Tools/bsc_makeFGsFromClassification_v4.m (100%) rename bsc_makeWBFGandClassFromList.m => ClassificationStruc_Tools/bsc_makeWBFGandClassFromList.m (100%) rename bsc_mergeFGandClass.m => ClassificationStruc_Tools/bsc_mergeFGandClass.m (100%) rename bsc_reconcileClassifications.m => ClassificationStruc_Tools/bsc_reconcileClassifications.m (100%) rename bsc_spliceClassifications.m => ClassificationStruc_Tools/bsc_spliceClassifications.m (100%) rename classificationFromMultiTCK.m => ClassificationStruc_Tools/classificationFromMultiTCK.m (100%) rename bsc_makeFGsFromClassification.m => ClassificationStruc_Tools/deprecated/bsc_makeFGsFromClassification.m (100%) rename bsc_makeFGsFromClassification_v2.m => ClassificationStruc_Tools/deprecated/bsc_makeFGsFromClassification_v2.m (100%) rename bsc_makeFGsFromClassification_v3.m => ClassificationStruc_Tools/deprecated/bsc_makeFGsFromClassification_v3.m (100%) rename removeOutliersClassification.m => ClassificationStruc_Tools/removeOutliersClassification.m (100%) rename wma_classificationStrucGrouping.m => ClassificationStruc_Tools/wma_classificationStrucGrouping.m (100%) rename wma_clearNonvalidClassifications.m => ClassificationStruc_Tools/wma_clearNonvalidClassifications.m (100%) rename wma_resortClassificationStruc.m => ClassificationStruc_Tools/wma_resortClassificationStruc.m (100%) rename bsc_plotEndpointsOnFG.m => Debug_Tools/bsc_plotEndpointsOnFG.m (100%) rename bsc_quickPlot.m => Debug_Tools/bsc_quickPlot.m (100%) rename bsc_atlasROINumsFromCoords.m => ROI_Tools/Deprecated/bsc_atlasROINumsFromCoords.m (100%) rename bsc_atlasROINumsFromCoordsInterp.m => ROI_Tools/Deprecated/bsc_atlasROINumsFromCoordsInterp.m (100%) rename bsc_atlasROINumsFromCoords_v2.m => ROI_Tools/Deprecated/bsc_atlasROINumsFromCoords_v2.m (100%) rename bsc_makePlanarROI.m => ROI_Tools/Deprecated/bsc_makePlanarROI.m (100%) rename bsc_niftiROIFromAtlasNums.m => ROI_Tools/Deprecated/bsc_niftiROIFromAtlasNums.m (100%) rename bsc_planeFromROI.m => ROI_Tools/Deprecated/bsc_planeFromROI.m (100%) rename bsc_roiFromFSnums.m => ROI_Tools/Deprecated/bsc_roiFromFSnums.m (100%) rename wma_roiFromAtlasNum.m => ROI_Tools/Deprecated/wma_roiFromAtlasNum.m (100%) rename wma_roiFromFSnums.m => ROI_Tools/Deprecated/wma_roiFromFSnums.m (100%) rename bsc_MultiIntersectROIs.m => ROI_Tools/bsc_MultiIntersectROIs.m (100%) rename bsc_atlasROINumsFromCoords_v3.m => ROI_Tools/bsc_atlasROINumsFromCoords_v3.m (100%) rename bsc_endpointAtlasCriteria.m => ROI_Tools/bsc_endpointAtlasCriteria.m (100%) rename bsc_intersectROIs.m => ROI_Tools/bsc_intersectROIs.m (100%) rename bsc_loadAndParseROI.m => ROI_Tools/bsc_loadAndParseROI.m (100%) rename bsc_makePlanarROI_v2.m => ROI_Tools/bsc_makePlanarROI_v2.m (100%) rename bsc_mergeROIs.m => ROI_Tools/bsc_mergeROIs.m (100%) rename bsc_midpointROISegment.m => ROI_Tools/bsc_midpointROISegment.m (100%) rename bsc_modifyROI_v2.m => ROI_Tools/bsc_modifyROI_v2.m (100%) rename bsc_planeFromROI_v2.m => ROI_Tools/bsc_planeFromROI_v2.m (100%) rename bsc_roiFromAtlasNums.m => ROI_Tools/bsc_roiFromAtlasNums.m (100%) rename bsc_shiftROI.m => ROI_Tools/bsc_shiftROI.m (100%) rename bsc_sliceAmalgumROIatCoords.m => ROI_Tools/bsc_sliceAmalgumROIatCoords.m (100%) rename bsc_subtractROIs.m => ROI_Tools/bsc_subtractROIs.m (100%) rename bsc_tractByEndpointROIs.m => ROI_Tools/bsc_tractByEndpointROIs.m (100%) rename multiROIpairSeg.m => ROI_Tools/multiROIpairSeg.m (100%) rename wma_SegmentFascicleFromConnectome.m => ROI_Tools/wma_SegmentFascicleFromConnectome.m (100%) rename wma_multiSliceAmalgumROIatCoords_BL.m => ROI_Tools/wma_multiSliceAmalgumROIatCoords_BL.m (100%) rename bsc_opticRadiationSeg_V6.m => Segmentations/Examples/bsc_opticRadiationSeg_V6.m (100%) rename {Examples => Segmentations/Examples}/bsc_segmentAslant.m (100%) rename {Examples => Segmentations/Examples}/bsc_segmentMdLF_ILF_v3.m (100%) rename {Examples => Segmentations/Examples}/bsc_segpArcTPC.m (100%) rename {Examples => Segmentations/Examples}/wma_segLobes_v2.m (100%) rename bsc_opticRadiationSeg_V7.m => Segmentations/bsc_opticRadiationSeg_V7.m (100%) rename bsc_segmentAntPostTracts_v3.m => Segmentations/bsc_segmentAntPostTracts_v3.m (100%) rename bsc_segmentAslant.m => Segmentations/bsc_segmentAslant.m (100%) rename bsc_segmentCST.m => Segmentations/bsc_segmentCST.m (100%) rename bsc_segmentCerebellarTracts_v2.m => Segmentations/bsc_segmentCerebellarTracts_v2.m (100%) rename bsc_segmentCingulum_v3.m => Segmentations/bsc_segmentCingulum_v3.m (100%) rename bsc_segmentCorpusCallosum_v3.m => Segmentations/bsc_segmentCorpusCallosum_v3.m (100%) rename bsc_segmentMdLF_ILF_v4.m => Segmentations/bsc_segmentMdLF_ILF_v4.m (100%) rename bsc_segmentSubCortical_v2.m => Segmentations/bsc_segmentSubCortical_v2.m (100%) rename bsc_segmentSuperficialFibers.m => Segmentations/bsc_segmentSuperficialFibers.m (100%) rename bsc_segmentVOF_v4.m => Segmentations/bsc_segmentVOF_v4.m (100%) rename bsc_segpArcTPC.m => Segmentations/bsc_segpArcTPC.m (100%) rename bsc_streamlineCategoryPriors_v6.m => Segmentations/bsc_streamlineCategoryPriors_v6.m (100%) rename wma_segLobes_v2.m => Segmentations/wma_segLobes_v2.m (100%) rename bsc_applyEndpointCriteria.m => Stream_Tools/bsc_applyEndpointCriteria.m (100%) rename bsc_applyMidpointCriteria.m => Stream_Tools/bsc_applyMidpointCriteria.m (100%) rename bsc_classifiedStreamEndpointCortex.m => Stream_Tools/bsc_classifiedStreamEndpointCortex.m (100%) rename bsc_investigateTract.m => Stream_Tools/bsc_investigateTract.m (100%) rename bsc_reorientFiber.m => Stream_Tools/bsc_reorientFiber.m (100%) rename bsc_reorientStreamline.m => Stream_Tools/bsc_reorientStreamline.m (100%) rename bsc_splitTractAtPoint.m => Stream_Tools/bsc_splitTractAtPoint.m (100%) rename endpointClusterProto.m => Stream_Tools/endpointClusterProto.m (100%) rename distinguishable_colors.m => Utils/External/distinguishable_colors.m (100%) rename fg2Array.m => Utils/External/fg2Array.m (100%) rename redblue.m => Utils/External/redblue.m (100%) rename startUniqueParpool.m => Utils/External/startUniqueParpool.m (100%) rename WMA_seg_ToolkitDummy.m => Utils/GitUtils/WMA_seg_ToolkitDummy.m (100%) rename wma_makeFunctionListTxt.m => Utils/GitUtils/wma_makeFunctionListTxt.m (100%) rename wma_makeGitDirTree.m => Utils/GitUtils/wma_makeGitDirTree.m (100%) rename wma_makeGitUtilityDir.m => Utils/GitUtils/wma_makeGitUtilityDir.m (100%) rename bsc_LoadAndParseFiberStructure.m => Utils/Loaders/bsc_LoadAndParseFiberStructure.m (100%) rename wma_loadTck.m => Utils/Loaders/wma_loadTck.m (100%) rename bsc_MBAplotTracts_BL.m => Visualization/bsc_MBAplotTracts_BL.m (100%) rename bsc_plotClassifiedStreamsAdaptive_v2.m => Visualization/bsc_plotClassifiedStreamsAdaptive_v2.m (100%) diff --git a/ConnectomeTestQ_v2.m b/Analysis/ConnectomeTestQ_v2.m similarity index 100% rename from ConnectomeTestQ_v2.m rename to Analysis/ConnectomeTestQ_v2.m diff --git a/bsc_csvTables2DataStruc.m b/Analysis/bsc_csvTables2DataStruc.m similarity index 100% rename from bsc_csvTables2DataStruc.m rename to Analysis/bsc_csvTables2DataStruc.m diff --git a/bsc_feAndSegQualityCheck.m b/Analysis/bsc_feAndSegQualityCheck.m similarity index 100% rename from bsc_feAndSegQualityCheck.m rename to Analysis/bsc_feAndSegQualityCheck.m diff --git a/bsc_normalizeStatMeasures_pathsVersion_v2.m b/Analysis/bsc_normalizeStatMeasures_pathsVersion_v2.m similarity index 100% rename from bsc_normalizeStatMeasures_pathsVersion_v2.m rename to Analysis/bsc_normalizeStatMeasures_pathsVersion_v2.m diff --git a/bsc_plotTractZscoreMeasures_pathsVersion.m b/Analysis/bsc_plotTractZscoreMeasures_pathsVersion.m similarity index 100% rename from bsc_plotTractZscoreMeasures_pathsVersion.m rename to Analysis/bsc_plotTractZscoreMeasures_pathsVersion.m diff --git a/bsc_plotZscoreMeasuresFromCSV.m b/Analysis/bsc_plotZscoreMeasuresFromCSV.m similarity index 100% rename from bsc_plotZscoreMeasuresFromCSV.m rename to Analysis/bsc_plotZscoreMeasuresFromCSV.m diff --git a/bsc_saveTrackCheckList_pathsVersion.m b/Analysis/bsc_saveTrackCheckList_pathsVersion.m similarity index 100% rename from bsc_saveTrackCheckList_pathsVersion.m rename to Analysis/bsc_saveTrackCheckList_pathsVersion.m diff --git a/bsc_saveTrackCheckList_pathsVersion_v2.m b/Analysis/bsc_saveTrackCheckList_pathsVersion_v2.m similarity index 100% rename from bsc_saveTrackCheckList_pathsVersion_v2.m rename to Analysis/bsc_saveTrackCheckList_pathsVersion_v2.m diff --git a/bsc_streamlineGeometryPriors.m b/Analysis/bsc_streamlineGeometryPriors.m similarity index 100% rename from bsc_streamlineGeometryPriors.m rename to Analysis/bsc_streamlineGeometryPriors.m diff --git a/bsc_tableAverages.m b/Analysis/bsc_tableAverages.m similarity index 100% rename from bsc_tableAverages.m rename to Analysis/bsc_tableAverages.m diff --git a/bsc_tableAverages_v3.m b/Analysis/bsc_tableAverages_v3.m similarity index 100% rename from bsc_tableAverages_v3.m rename to Analysis/bsc_tableAverages_v3.m diff --git a/bsc_normalizeStatMeasures_pathsVersion.m b/Analysis/deprecated/bsc_normalizeStatMeasures_pathsVersion.m similarity index 100% rename from bsc_normalizeStatMeasures_pathsVersion.m rename to Analysis/deprecated/bsc_normalizeStatMeasures_pathsVersion.m diff --git a/wma_endpointMapsDecay_v5.m b/Analysis/wma_endpointMapsDecay_v5.m similarity index 100% rename from wma_endpointMapsDecay_v5.m rename to Analysis/wma_endpointMapsDecay_v5.m diff --git a/wma_quantAllWMNorm.m b/Analysis/wma_quantAllWMNorm.m similarity index 100% rename from wma_quantAllWMNorm.m rename to Analysis/wma_quantAllWMNorm.m diff --git a/wma_quantTract.m b/Analysis/wma_quantTract.m similarity index 100% rename from wma_quantTract.m rename to Analysis/wma_quantTract.m diff --git a/wma_quantWBFG.m b/Analysis/wma_quantWBFG.m similarity index 100% rename from wma_quantWBFG.m rename to Analysis/wma_quantWBFG.m diff --git a/bsc_inflateLabels.m b/Atlas_tools/bsc_inflateLabels.m similarity index 100% rename from bsc_inflateLabels.m rename to Atlas_tools/bsc_inflateLabels.m diff --git a/bsc_inflateLabels_v2.m b/Atlas_tools/bsc_inflateLabels_v2.m similarity index 100% rename from bsc_inflateLabels_v2.m rename to Atlas_tools/bsc_inflateLabels_v2.m diff --git a/fnDeislandLabels_v2.m b/Atlas_tools/fnDeislandLabels_v2.m similarity index 100% rename from fnDeislandLabels_v2.m rename to Atlas_tools/fnDeislandLabels_v2.m diff --git a/wma_getAsegFile.m b/Atlas_tools/wma_getAsegFile.m similarity index 100% rename from wma_getAsegFile.m rename to Atlas_tools/wma_getAsegFile.m diff --git a/wma_formatForBrainLife.m b/BL_Wrappers/Formatters/wma_formatForBrainLife.m similarity index 100% rename from wma_formatForBrainLife.m rename to BL_Wrappers/Formatters/wma_formatForBrainLife.m diff --git a/wma_formatForBrainLife_v2.m b/BL_Wrappers/Formatters/wma_formatForBrainLife_v2.m similarity index 100% rename from wma_formatForBrainLife_v2.m rename to BL_Wrappers/Formatters/wma_formatForBrainLife_v2.m diff --git a/bsc_GenROIfromPairStringList_BL.m b/BL_Wrappers/bsc_GenROIfromPairStringList_BL.m similarity index 100% rename from bsc_GenROIfromPairStringList_BL.m rename to BL_Wrappers/bsc_GenROIfromPairStringList_BL.m diff --git a/bsc_GenROIfromPairStringList_v2_BL.m b/BL_Wrappers/bsc_GenROIfromPairStringList_v2_BL.m similarity index 100% rename from bsc_GenROIfromPairStringList_v2_BL.m rename to BL_Wrappers/bsc_GenROIfromPairStringList_v2_BL.m diff --git a/bsc_SegROIfromPairStringList_BL.m b/BL_Wrappers/bsc_SegROIfromPairStringList_BL.m similarity index 100% rename from bsc_SegROIfromPairStringList_BL.m rename to BL_Wrappers/bsc_SegROIfromPairStringList_BL.m diff --git a/bsc_SegROIfromPairStringList_v2_BL.m b/BL_Wrappers/bsc_SegROIfromPairStringList_v2_BL.m similarity index 100% rename from bsc_SegROIfromPairStringList_v2_BL.m rename to BL_Wrappers/bsc_SegROIfromPairStringList_v2_BL.m diff --git a/bsc_classifiedStreamEndpointCortex_BL.m b/BL_Wrappers/bsc_classifiedStreamEndpointCortex_BL.m similarity index 100% rename from bsc_classifiedStreamEndpointCortex_BL.m rename to BL_Wrappers/bsc_classifiedStreamEndpointCortex_BL.m diff --git a/bsc_feAndSegQualityCheck_BL.m b/BL_Wrappers/bsc_feAndSegQualityCheck_BL.m similarity index 100% rename from bsc_feAndSegQualityCheck_BL.m rename to BL_Wrappers/bsc_feAndSegQualityCheck_BL.m diff --git a/bsc_feAndSegQualityCheck_BL_v2.m b/BL_Wrappers/bsc_feAndSegQualityCheck_BL_v2.m similarity index 100% rename from bsc_feAndSegQualityCheck_BL_v2.m rename to BL_Wrappers/bsc_feAndSegQualityCheck_BL_v2.m diff --git a/bsc_groupTractPlots_BL.m b/BL_Wrappers/bsc_groupTractPlots_BL.m similarity index 100% rename from bsc_groupTractPlots_BL.m rename to BL_Wrappers/bsc_groupTractPlots_BL.m diff --git a/bsc_streamlineCategoryPriors_BL.m b/BL_Wrappers/bsc_streamlineCategoryPriors_BL.m similarity index 100% rename from bsc_streamlineCategoryPriors_BL.m rename to BL_Wrappers/bsc_streamlineCategoryPriors_BL.m diff --git a/bsc_concatClassificationCriteria.m b/ClassificationStruc_Tools/bsc_concatClassificationCriteria.m similarity index 100% rename from bsc_concatClassificationCriteria.m rename to ClassificationStruc_Tools/bsc_concatClassificationCriteria.m diff --git a/bsc_extractClassification.m b/ClassificationStruc_Tools/bsc_extractClassification.m similarity index 100% rename from bsc_extractClassification.m rename to ClassificationStruc_Tools/bsc_extractClassification.m diff --git a/bsc_extractStreamIndByName.m b/ClassificationStruc_Tools/bsc_extractStreamIndByName.m similarity index 100% rename from bsc_extractStreamIndByName.m rename to ClassificationStruc_Tools/bsc_extractStreamIndByName.m diff --git a/bsc_makeFGsFromClassification_v4.m b/ClassificationStruc_Tools/bsc_makeFGsFromClassification_v4.m similarity index 100% rename from bsc_makeFGsFromClassification_v4.m rename to ClassificationStruc_Tools/bsc_makeFGsFromClassification_v4.m diff --git a/bsc_makeWBFGandClassFromList.m b/ClassificationStruc_Tools/bsc_makeWBFGandClassFromList.m similarity index 100% rename from bsc_makeWBFGandClassFromList.m rename to ClassificationStruc_Tools/bsc_makeWBFGandClassFromList.m diff --git a/bsc_mergeFGandClass.m b/ClassificationStruc_Tools/bsc_mergeFGandClass.m similarity index 100% rename from bsc_mergeFGandClass.m rename to ClassificationStruc_Tools/bsc_mergeFGandClass.m diff --git a/bsc_reconcileClassifications.m b/ClassificationStruc_Tools/bsc_reconcileClassifications.m similarity index 100% rename from bsc_reconcileClassifications.m rename to ClassificationStruc_Tools/bsc_reconcileClassifications.m diff --git a/bsc_spliceClassifications.m b/ClassificationStruc_Tools/bsc_spliceClassifications.m similarity index 100% rename from bsc_spliceClassifications.m rename to ClassificationStruc_Tools/bsc_spliceClassifications.m diff --git a/classificationFromMultiTCK.m b/ClassificationStruc_Tools/classificationFromMultiTCK.m similarity index 100% rename from classificationFromMultiTCK.m rename to ClassificationStruc_Tools/classificationFromMultiTCK.m diff --git a/bsc_makeFGsFromClassification.m b/ClassificationStruc_Tools/deprecated/bsc_makeFGsFromClassification.m similarity index 100% rename from bsc_makeFGsFromClassification.m rename to ClassificationStruc_Tools/deprecated/bsc_makeFGsFromClassification.m diff --git a/bsc_makeFGsFromClassification_v2.m b/ClassificationStruc_Tools/deprecated/bsc_makeFGsFromClassification_v2.m similarity index 100% rename from bsc_makeFGsFromClassification_v2.m rename to ClassificationStruc_Tools/deprecated/bsc_makeFGsFromClassification_v2.m diff --git a/bsc_makeFGsFromClassification_v3.m b/ClassificationStruc_Tools/deprecated/bsc_makeFGsFromClassification_v3.m similarity index 100% rename from bsc_makeFGsFromClassification_v3.m rename to ClassificationStruc_Tools/deprecated/bsc_makeFGsFromClassification_v3.m diff --git a/removeOutliersClassification.m b/ClassificationStruc_Tools/removeOutliersClassification.m similarity index 100% rename from removeOutliersClassification.m rename to ClassificationStruc_Tools/removeOutliersClassification.m diff --git a/wma_classificationStrucGrouping.m b/ClassificationStruc_Tools/wma_classificationStrucGrouping.m similarity index 100% rename from wma_classificationStrucGrouping.m rename to ClassificationStruc_Tools/wma_classificationStrucGrouping.m diff --git a/wma_clearNonvalidClassifications.m b/ClassificationStruc_Tools/wma_clearNonvalidClassifications.m similarity index 100% rename from wma_clearNonvalidClassifications.m rename to ClassificationStruc_Tools/wma_clearNonvalidClassifications.m diff --git a/wma_resortClassificationStruc.m b/ClassificationStruc_Tools/wma_resortClassificationStruc.m similarity index 100% rename from wma_resortClassificationStruc.m rename to ClassificationStruc_Tools/wma_resortClassificationStruc.m diff --git a/bsc_plotEndpointsOnFG.m b/Debug_Tools/bsc_plotEndpointsOnFG.m similarity index 100% rename from bsc_plotEndpointsOnFG.m rename to Debug_Tools/bsc_plotEndpointsOnFG.m diff --git a/bsc_quickPlot.m b/Debug_Tools/bsc_quickPlot.m similarity index 100% rename from bsc_quickPlot.m rename to Debug_Tools/bsc_quickPlot.m diff --git a/bsc_atlasROINumsFromCoords.m b/ROI_Tools/Deprecated/bsc_atlasROINumsFromCoords.m similarity index 100% rename from bsc_atlasROINumsFromCoords.m rename to ROI_Tools/Deprecated/bsc_atlasROINumsFromCoords.m diff --git a/bsc_atlasROINumsFromCoordsInterp.m b/ROI_Tools/Deprecated/bsc_atlasROINumsFromCoordsInterp.m similarity index 100% rename from bsc_atlasROINumsFromCoordsInterp.m rename to ROI_Tools/Deprecated/bsc_atlasROINumsFromCoordsInterp.m diff --git a/bsc_atlasROINumsFromCoords_v2.m b/ROI_Tools/Deprecated/bsc_atlasROINumsFromCoords_v2.m similarity index 100% rename from bsc_atlasROINumsFromCoords_v2.m rename to ROI_Tools/Deprecated/bsc_atlasROINumsFromCoords_v2.m diff --git a/bsc_makePlanarROI.m b/ROI_Tools/Deprecated/bsc_makePlanarROI.m similarity index 100% rename from bsc_makePlanarROI.m rename to ROI_Tools/Deprecated/bsc_makePlanarROI.m diff --git a/bsc_niftiROIFromAtlasNums.m b/ROI_Tools/Deprecated/bsc_niftiROIFromAtlasNums.m similarity index 100% rename from bsc_niftiROIFromAtlasNums.m rename to ROI_Tools/Deprecated/bsc_niftiROIFromAtlasNums.m diff --git a/bsc_planeFromROI.m b/ROI_Tools/Deprecated/bsc_planeFromROI.m similarity index 100% rename from bsc_planeFromROI.m rename to ROI_Tools/Deprecated/bsc_planeFromROI.m diff --git a/bsc_roiFromFSnums.m b/ROI_Tools/Deprecated/bsc_roiFromFSnums.m similarity index 100% rename from bsc_roiFromFSnums.m rename to ROI_Tools/Deprecated/bsc_roiFromFSnums.m diff --git a/wma_roiFromAtlasNum.m b/ROI_Tools/Deprecated/wma_roiFromAtlasNum.m similarity index 100% rename from wma_roiFromAtlasNum.m rename to ROI_Tools/Deprecated/wma_roiFromAtlasNum.m diff --git a/wma_roiFromFSnums.m b/ROI_Tools/Deprecated/wma_roiFromFSnums.m similarity index 100% rename from wma_roiFromFSnums.m rename to ROI_Tools/Deprecated/wma_roiFromFSnums.m diff --git a/bsc_MultiIntersectROIs.m b/ROI_Tools/bsc_MultiIntersectROIs.m similarity index 100% rename from bsc_MultiIntersectROIs.m rename to ROI_Tools/bsc_MultiIntersectROIs.m diff --git a/bsc_atlasROINumsFromCoords_v3.m b/ROI_Tools/bsc_atlasROINumsFromCoords_v3.m similarity index 100% rename from bsc_atlasROINumsFromCoords_v3.m rename to ROI_Tools/bsc_atlasROINumsFromCoords_v3.m diff --git a/bsc_endpointAtlasCriteria.m b/ROI_Tools/bsc_endpointAtlasCriteria.m similarity index 100% rename from bsc_endpointAtlasCriteria.m rename to ROI_Tools/bsc_endpointAtlasCriteria.m diff --git a/bsc_intersectROIs.m b/ROI_Tools/bsc_intersectROIs.m similarity index 100% rename from bsc_intersectROIs.m rename to ROI_Tools/bsc_intersectROIs.m diff --git a/bsc_loadAndParseROI.m b/ROI_Tools/bsc_loadAndParseROI.m similarity index 100% rename from bsc_loadAndParseROI.m rename to ROI_Tools/bsc_loadAndParseROI.m diff --git a/bsc_makePlanarROI_v2.m b/ROI_Tools/bsc_makePlanarROI_v2.m similarity index 100% rename from bsc_makePlanarROI_v2.m rename to ROI_Tools/bsc_makePlanarROI_v2.m diff --git a/bsc_mergeROIs.m b/ROI_Tools/bsc_mergeROIs.m similarity index 100% rename from bsc_mergeROIs.m rename to ROI_Tools/bsc_mergeROIs.m diff --git a/bsc_midpointROISegment.m b/ROI_Tools/bsc_midpointROISegment.m similarity index 100% rename from bsc_midpointROISegment.m rename to ROI_Tools/bsc_midpointROISegment.m diff --git a/bsc_modifyROI_v2.m b/ROI_Tools/bsc_modifyROI_v2.m similarity index 100% rename from bsc_modifyROI_v2.m rename to ROI_Tools/bsc_modifyROI_v2.m diff --git a/bsc_planeFromROI_v2.m b/ROI_Tools/bsc_planeFromROI_v2.m similarity index 100% rename from bsc_planeFromROI_v2.m rename to ROI_Tools/bsc_planeFromROI_v2.m diff --git a/bsc_roiFromAtlasNums.m b/ROI_Tools/bsc_roiFromAtlasNums.m similarity index 100% rename from bsc_roiFromAtlasNums.m rename to ROI_Tools/bsc_roiFromAtlasNums.m diff --git a/bsc_shiftROI.m b/ROI_Tools/bsc_shiftROI.m similarity index 100% rename from bsc_shiftROI.m rename to ROI_Tools/bsc_shiftROI.m diff --git a/bsc_sliceAmalgumROIatCoords.m b/ROI_Tools/bsc_sliceAmalgumROIatCoords.m similarity index 100% rename from bsc_sliceAmalgumROIatCoords.m rename to ROI_Tools/bsc_sliceAmalgumROIatCoords.m diff --git a/bsc_subtractROIs.m b/ROI_Tools/bsc_subtractROIs.m similarity index 100% rename from bsc_subtractROIs.m rename to ROI_Tools/bsc_subtractROIs.m diff --git a/bsc_tractByEndpointROIs.m b/ROI_Tools/bsc_tractByEndpointROIs.m similarity index 100% rename from bsc_tractByEndpointROIs.m rename to ROI_Tools/bsc_tractByEndpointROIs.m diff --git a/multiROIpairSeg.m b/ROI_Tools/multiROIpairSeg.m similarity index 100% rename from multiROIpairSeg.m rename to ROI_Tools/multiROIpairSeg.m diff --git a/wma_SegmentFascicleFromConnectome.m b/ROI_Tools/wma_SegmentFascicleFromConnectome.m similarity index 100% rename from wma_SegmentFascicleFromConnectome.m rename to ROI_Tools/wma_SegmentFascicleFromConnectome.m diff --git a/wma_multiSliceAmalgumROIatCoords_BL.m b/ROI_Tools/wma_multiSliceAmalgumROIatCoords_BL.m similarity index 100% rename from wma_multiSliceAmalgumROIatCoords_BL.m rename to ROI_Tools/wma_multiSliceAmalgumROIatCoords_BL.m diff --git a/bsc_opticRadiationSeg_V6.m b/Segmentations/Examples/bsc_opticRadiationSeg_V6.m similarity index 100% rename from bsc_opticRadiationSeg_V6.m rename to Segmentations/Examples/bsc_opticRadiationSeg_V6.m diff --git a/Examples/bsc_segmentAslant.m b/Segmentations/Examples/bsc_segmentAslant.m similarity index 100% rename from Examples/bsc_segmentAslant.m rename to Segmentations/Examples/bsc_segmentAslant.m diff --git a/Examples/bsc_segmentMdLF_ILF_v3.m b/Segmentations/Examples/bsc_segmentMdLF_ILF_v3.m similarity index 100% rename from Examples/bsc_segmentMdLF_ILF_v3.m rename to Segmentations/Examples/bsc_segmentMdLF_ILF_v3.m diff --git a/Examples/bsc_segpArcTPC.m b/Segmentations/Examples/bsc_segpArcTPC.m similarity index 100% rename from Examples/bsc_segpArcTPC.m rename to Segmentations/Examples/bsc_segpArcTPC.m diff --git a/Examples/wma_segLobes_v2.m b/Segmentations/Examples/wma_segLobes_v2.m similarity index 100% rename from Examples/wma_segLobes_v2.m rename to Segmentations/Examples/wma_segLobes_v2.m diff --git a/bsc_opticRadiationSeg_V7.m b/Segmentations/bsc_opticRadiationSeg_V7.m similarity index 100% rename from bsc_opticRadiationSeg_V7.m rename to Segmentations/bsc_opticRadiationSeg_V7.m diff --git a/bsc_segmentAntPostTracts_v3.m b/Segmentations/bsc_segmentAntPostTracts_v3.m similarity index 100% rename from bsc_segmentAntPostTracts_v3.m rename to Segmentations/bsc_segmentAntPostTracts_v3.m diff --git a/bsc_segmentAslant.m b/Segmentations/bsc_segmentAslant.m similarity index 100% rename from bsc_segmentAslant.m rename to Segmentations/bsc_segmentAslant.m diff --git a/bsc_segmentCST.m b/Segmentations/bsc_segmentCST.m similarity index 100% rename from bsc_segmentCST.m rename to Segmentations/bsc_segmentCST.m diff --git a/bsc_segmentCerebellarTracts_v2.m b/Segmentations/bsc_segmentCerebellarTracts_v2.m similarity index 100% rename from bsc_segmentCerebellarTracts_v2.m rename to Segmentations/bsc_segmentCerebellarTracts_v2.m diff --git a/bsc_segmentCingulum_v3.m b/Segmentations/bsc_segmentCingulum_v3.m similarity index 100% rename from bsc_segmentCingulum_v3.m rename to Segmentations/bsc_segmentCingulum_v3.m diff --git a/bsc_segmentCorpusCallosum_v3.m b/Segmentations/bsc_segmentCorpusCallosum_v3.m similarity index 100% rename from bsc_segmentCorpusCallosum_v3.m rename to Segmentations/bsc_segmentCorpusCallosum_v3.m diff --git a/bsc_segmentMdLF_ILF_v4.m b/Segmentations/bsc_segmentMdLF_ILF_v4.m similarity index 100% rename from bsc_segmentMdLF_ILF_v4.m rename to Segmentations/bsc_segmentMdLF_ILF_v4.m diff --git a/bsc_segmentSubCortical_v2.m b/Segmentations/bsc_segmentSubCortical_v2.m similarity index 100% rename from bsc_segmentSubCortical_v2.m rename to Segmentations/bsc_segmentSubCortical_v2.m diff --git a/bsc_segmentSuperficialFibers.m b/Segmentations/bsc_segmentSuperficialFibers.m similarity index 100% rename from bsc_segmentSuperficialFibers.m rename to Segmentations/bsc_segmentSuperficialFibers.m diff --git a/bsc_segmentVOF_v4.m b/Segmentations/bsc_segmentVOF_v4.m similarity index 100% rename from bsc_segmentVOF_v4.m rename to Segmentations/bsc_segmentVOF_v4.m diff --git a/bsc_segpArcTPC.m b/Segmentations/bsc_segpArcTPC.m similarity index 100% rename from bsc_segpArcTPC.m rename to Segmentations/bsc_segpArcTPC.m diff --git a/bsc_streamlineCategoryPriors_v6.m b/Segmentations/bsc_streamlineCategoryPriors_v6.m similarity index 100% rename from bsc_streamlineCategoryPriors_v6.m rename to Segmentations/bsc_streamlineCategoryPriors_v6.m diff --git a/wma_segLobes_v2.m b/Segmentations/wma_segLobes_v2.m similarity index 100% rename from wma_segLobes_v2.m rename to Segmentations/wma_segLobes_v2.m diff --git a/bsc_applyEndpointCriteria.m b/Stream_Tools/bsc_applyEndpointCriteria.m similarity index 100% rename from bsc_applyEndpointCriteria.m rename to Stream_Tools/bsc_applyEndpointCriteria.m diff --git a/bsc_applyMidpointCriteria.m b/Stream_Tools/bsc_applyMidpointCriteria.m similarity index 100% rename from bsc_applyMidpointCriteria.m rename to Stream_Tools/bsc_applyMidpointCriteria.m diff --git a/bsc_classifiedStreamEndpointCortex.m b/Stream_Tools/bsc_classifiedStreamEndpointCortex.m similarity index 100% rename from bsc_classifiedStreamEndpointCortex.m rename to Stream_Tools/bsc_classifiedStreamEndpointCortex.m diff --git a/bsc_investigateTract.m b/Stream_Tools/bsc_investigateTract.m similarity index 100% rename from bsc_investigateTract.m rename to Stream_Tools/bsc_investigateTract.m diff --git a/bsc_reorientFiber.m b/Stream_Tools/bsc_reorientFiber.m similarity index 100% rename from bsc_reorientFiber.m rename to Stream_Tools/bsc_reorientFiber.m diff --git a/bsc_reorientStreamline.m b/Stream_Tools/bsc_reorientStreamline.m similarity index 100% rename from bsc_reorientStreamline.m rename to Stream_Tools/bsc_reorientStreamline.m diff --git a/bsc_splitTractAtPoint.m b/Stream_Tools/bsc_splitTractAtPoint.m similarity index 100% rename from bsc_splitTractAtPoint.m rename to Stream_Tools/bsc_splitTractAtPoint.m diff --git a/endpointClusterProto.m b/Stream_Tools/endpointClusterProto.m similarity index 100% rename from endpointClusterProto.m rename to Stream_Tools/endpointClusterProto.m diff --git a/distinguishable_colors.m b/Utils/External/distinguishable_colors.m similarity index 100% rename from distinguishable_colors.m rename to Utils/External/distinguishable_colors.m diff --git a/fg2Array.m b/Utils/External/fg2Array.m similarity index 100% rename from fg2Array.m rename to Utils/External/fg2Array.m diff --git a/redblue.m b/Utils/External/redblue.m similarity index 100% rename from redblue.m rename to Utils/External/redblue.m diff --git a/startUniqueParpool.m b/Utils/External/startUniqueParpool.m similarity index 100% rename from startUniqueParpool.m rename to Utils/External/startUniqueParpool.m diff --git a/WMA_seg_ToolkitDummy.m b/Utils/GitUtils/WMA_seg_ToolkitDummy.m similarity index 100% rename from WMA_seg_ToolkitDummy.m rename to Utils/GitUtils/WMA_seg_ToolkitDummy.m diff --git a/wma_makeFunctionListTxt.m b/Utils/GitUtils/wma_makeFunctionListTxt.m similarity index 100% rename from wma_makeFunctionListTxt.m rename to Utils/GitUtils/wma_makeFunctionListTxt.m diff --git a/wma_makeGitDirTree.m b/Utils/GitUtils/wma_makeGitDirTree.m similarity index 100% rename from wma_makeGitDirTree.m rename to Utils/GitUtils/wma_makeGitDirTree.m diff --git a/wma_makeGitUtilityDir.m b/Utils/GitUtils/wma_makeGitUtilityDir.m similarity index 100% rename from wma_makeGitUtilityDir.m rename to Utils/GitUtils/wma_makeGitUtilityDir.m diff --git a/bsc_LoadAndParseFiberStructure.m b/Utils/Loaders/bsc_LoadAndParseFiberStructure.m similarity index 100% rename from bsc_LoadAndParseFiberStructure.m rename to Utils/Loaders/bsc_LoadAndParseFiberStructure.m diff --git a/wma_loadTck.m b/Utils/Loaders/wma_loadTck.m similarity index 100% rename from wma_loadTck.m rename to Utils/Loaders/wma_loadTck.m diff --git a/bsc_MBAplotTracts_BL.m b/Visualization/bsc_MBAplotTracts_BL.m similarity index 100% rename from bsc_MBAplotTracts_BL.m rename to Visualization/bsc_MBAplotTracts_BL.m diff --git a/bsc_plotClassifiedStreamsAdaptive_v2.m b/Visualization/bsc_plotClassifiedStreamsAdaptive_v2.m similarity index 100% rename from bsc_plotClassifiedStreamsAdaptive_v2.m rename to Visualization/bsc_plotClassifiedStreamsAdaptive_v2.m From 4e54877d66d98e555fae9ac708abcea7658e1543 Mon Sep 17 00:00:00 2001 From: Daniel Bullock Date: Wed, 8 Apr 2020 18:39:30 -0400 Subject: [PATCH 2/3] created segmentation template --- Segmentations/bsc_genericSegmentFunction.m | 194 +++++++++++++++++++++ Stream_Tools/bsc_applyEndpointCriteria.m | 19 +- 2 files changed, 202 insertions(+), 11 deletions(-) create mode 100644 Segmentations/bsc_genericSegmentFunction.m diff --git a/Segmentations/bsc_genericSegmentFunction.m b/Segmentations/bsc_genericSegmentFunction.m new file mode 100644 index 0000000..e9ea4fd --- /dev/null +++ b/Segmentations/bsc_genericSegmentFunction.m @@ -0,0 +1,194 @@ +function [classificationOut] =bsc_genericSegmentFunction(wbfg, fsDir, categoryClassification) +% [classificationOut] = bsc_genericSegmentFunction(wbfg, fsDir, categoryClassification) +% +% This is the template segmentation script for the refactored version of +% wma tools segmentations. This is being provided to serve as a basic +% framework for future segmentation functions and to illustrate the basic +% logic of this format. + +% Inputs: +% -wbfg: a whole brain fiber group structure +% -fsDir: path to the freesurfer directory for the subject +% -categoryClassification: the classification structure resulting from the +% classification segmentation. Done outside of this function to avoid +% doing it repeatedly + +% Outputs: +% -classificationOut: standardly constructed classification structure + +% (C) Daniel Bullock, 2020, Indiana University + +%% parameter notes & initialization + +%create left/right labels. For use with naming conventions later. +sideLabel={'left','right'}; + +%initialize classification structure +classificationOut=[]; +classificationOut.names=[]; +%make sure it is the same length as the input +classificationOut.index=zeros(length(wbfg.fibers),1); + +%set a path to the atlas you will be using. In truth, you can use any +%atlas. The key is that a number of functions (i.e. bsc_planeFromROI_v2 or +%bsc_roiFromAtlasNums +atlasPath=fullfile(fsDir,'/mri/','aparc.a2009s+aseg.nii.gz'); + +%Set some initial rois that don't follow a good convention. The reason we +%are doing this is that typically, when use aparc.a2009s we can designate +%left or right by adding 12000 or 11000 to a three digit number +%corresponding to a cortical roi. Subcortical rois (which are essential to +%anatomically based segmentations) do not follow this convention, and so +%they must be done in the following way. We can thus select between right +%and left rois by indexing into the variable with {1} or {2}, as set by the +%subsequent leftright variable +lentiLut=[12 13; 51 52]; +palLut=[13;52]; +thalLut=[10;49]; +ventricleLut=[4;43]; +wmLut=[2;41]; +DCLut=[28;60]; +hippLut=[17;53]; +amigLut=[18;54]; + + +%iterates through left and right sides +for leftright= [1,2] + + %sidenum is basically a way of switching between the left and right + %hemispheres of the brain in accordance with freesurfer's ROI + %numbering scheme. left = 1, right = 2 + sidenum=10000+leftright*1000; + + %% Tract 1 + %begin segmentation of tract 1 +%========================================================================= + %1. ESTABLISH CATEGORY CRITERIA + %usingthe category segmentation output, go ahead and establish a + %boolean index of the streamlines meeting this criteria. Will be used + %as part of a later logical conjunct. Here we use the example of + %within frontal lobe streamlines. + frontoFrontalBool= or( bsc_extractStreamIndByName(categoryPrior,strcat(sideLabel{leftright},'frontal_to_frontal')), bsc_extractStreamIndByName(categoryPrior,strcat(sideLabel{leftright},'frontal_to_frontal_ufiber'))); +%-------------------------------------------------------------------------- + + + %2. ESTABLISH MORE SPECIFIC ENDPOINT CRITERIA + %if you have more specific criteria (positive or negative) for the + %cortical terminations of your tract, do that here. +%========================================================================= + %2.1 extract the relevant rois from the atlas + %check function description for more details, leave final integer + %input at 1 for no inflation + [someROI1] =bsc_roiFromAtlasNums(atlasPath,[ROInums],1); + [someROI2] =bsc_roiFromAtlasNums(atlasPath,[ROInums],1); + + %2.2 Use ROIs to find the indexes of streamlines which terminate + %in those ROIS. Consider also using bsc_endpointAtlasCriteria, + %which does not require the rois to be extracted first, but does + %take a while if you send in the whole brain fiber group. It may + %be possible to make a variant of that function which impliments a + %speedup by preselecting using a bolean index input. + [~, corticalCriteriaBool] = bsc_tractByEndpointROIs(wbfg, {someROI1 someROI2}); + + %2.3 Add aditional criteria if you wish, for example if you want + %endpoints to be above a particular anatomical roi. Check the + %documentation for these functions to see how to apply them with + %other anatomical relations (e.g. 'medial', 'lateral', etc.) + superiorPlaneROI = bsc_planeFromROI_v2([ROInums], 'superior',atlasPath); + [relativeAnatomicalEndpointCriteriaBool]=bsc_applyEndpointCriteria(wbfg, superiorPlaneROI, 'superior','one'); +%-------------------------------------------------------------------------- + + + %3. APPLY GENERIC, ANATOMICALLY INFORMED CRITERIA + %at this point in the segmentation, you've already established where + %you want the streamlines to terminate, but this may still + %underdetermine the tract of interest. For example, I could be + %interested in fronto occipital streamlines, but these could go via a + %ventral (i.e. IFOF) or dorsal (i.e. the putative "SFOF", which probably + %doesn't really exist). To further subselect, we can apply additional + %criteria. We'll use an example of putting a plane above the posterior + %limit of the thalamus thalamus, such that we are (to some extent) + %selecting for streamlines taking the +%========================================================================== + %3.1 Application of anatomically informed planes + [superiorThalPlane]= bsc_planeFromROI_v2(thalLut(leftright), 'superior',atlasPath); + [posteriorThalPlane] = bsc_planeFromROI_v2(thalLut(leftright), 'posterior',atlasPath); + %now that we have the two planes we use the function + %bsc_modifyROI_v2 to use the superior plane to slice the posterior + %plane. Note: this would result in a different output if you + %switched the input rois. Check the function documentation for + %more details. + [superiorPosteriorThalPlane]=bsc_modifyROI_v2(atlasPath,posteriorThalPlane, superiorThalPlane, 'superior'); + %ALSO NOTE: this function is fairly versitile. You could instead + %input a roi number for the first roi input (input 2) and then cut + %it using the second roi input (which could instead be a specific + %3d coordinate rather than a full plane, if one wished). In this + %way you can further subsegment rois if they are too large for your + %purposes. + + %now that you have the plane, you can use whatever roi criteria + %function you prefer. Here we use a modified version of + %feSegmentFascicleFromConnectome. This function variant likely + %needs to be refactored and updated itself. Also remember, this + %could be applied as a exclusion criteria as well (via 'not') + [~, superiorPosteriorThalCriteriaBool] = wma_SegmentFascicleFromConnectome(wbfg, {superiorPosteriorThalPlane}, {'and'}, 'arbitraryName'); +%-------------------------------------------------------------------------- + %3.2 Application of anatomically informed volumetric rois + %One potential desired application might be that you wish to select + %streamlines which travel along or near a particular gyrus. We can + %use wma tools to select these white matter volumes. + + %note that we are inflating the cortical rois so that they will + %expand into the white matter. The inflation kernel (last + %variable) can be modified as needed. + [inflatedROI1] =bsc_roiFromAtlasNums(atlasPath,[ROInums],5); + [inflatedROI2] =bsc_roiFromAtlasNums(atlasPath,[ROInums],5); + [wmROI] =bsc_roiFromAtlasNums(atlasPath,wmLut{leftright},1); + + %here we take the intersection of the rois + [roi1WMintersection] = bsc_intersectROIs(inflatedROI1, wmROI); + [roi2WMintersection] = bsc_intersectROIs(inflatedROI2, wmROI); + + %now we take the volumetric overlap of the wm areas + [roi1and2WMintersection] = bsc_intersectROIs(roi1WMintersection, roi2WMintersection); + + %the resultant roi can now be used as a segmentation criteria + [~, wmVolumeCriteriaBool] = wma_SegmentFascicleFromConnectome(wbfg, {roi1and2WMintersection}, {'and'}, 'arbitraryName'); +%-------------------------------------------------------------------------- + %3.3 Application of other anatomically informed criteria + %One additional set of criteria that one might like to apply + %relates to the midpoints of the streamlines for the tract. For + %example may want the midpoints to be superior (or medial, lateral, + %etc.) to some plane. We can do this as well. + + %say we wanted to require our midpoints to be above the thalamus. + %We could use the planar roi generated in section 3.1 to do this + [superiorThalMidpointCriteriaBool]=bsc_applyMidpointCriteria(wbfg, superiorThalPlane,'superior'); +%-------------------------------------------------------------------------- + %4. APPLY ALL BOOLEAN CRITERIA + %now that we have obtained all of our desired criteria, in the form + %of several boolean vectors, it's time to apply them as a conjunct + %(many ands) to obtain a classification structure featuring this + %tract + tractNameVar=strcat(sideLabel{leftright},'TractName'); + classificationOut=bsc_concatClassificationCriteria(classificationOut,tractNameVar,frontoFrontalBool,corticalCriteriaBool,relativeAnatomicalEndpointCriteriaBool,superiorPosteriorThalCriteriaBool,wmVolumeCriteriaBool,superiorThalMidpointCriteriaBool); + +%% TRACT 2 +% now you can apply a similar series of requirements as above in order to +% segment another tract within this function. Why would you want to +% segment multiple tracts in one function? In some cases you may be using +% the same roi multiple times in order to segment several tracts. It would +% thus be useful to segment them in the same function and reuse the roi so +% that you don't have to keep regenerating it. Also, it may be the case +% that once you segment a tract, you can then exclude those tracts from a +% subsequent segmentation. In this way, you would be applying a criteria +% of [not a member of this previous tract] to some subsequent tract. + +%SPECIAL NOTE: Be sure to use bsc_concatClassificationCriteria after +%you've generated all of your boolean criteria for each tract. If you +%don't do this, it won't be added to the classification structure that is +%eventually output from this function +end + + +end \ No newline at end of file diff --git a/Stream_Tools/bsc_applyEndpointCriteria.m b/Stream_Tools/bsc_applyEndpointCriteria.m index 04ab3d4..e53d448 100644 --- a/Stream_Tools/bsc_applyEndpointCriteria.m +++ b/Stream_Tools/bsc_applyEndpointCriteria.m @@ -6,24 +6,21 @@ % criteria. % % INPUTS: -% -fg:fg s Will extract -% midpoints from fg structure if that is put in instead. It is recommended -% that midpoints be put in if this function is called multiple times within -% a script in order to increase speed. +% -fg: the fg the criteria will be applied to % -% -varargin: interprets sequential pairings of inputs as (1) a coordinate -% and (2) a relative criteria. For example -% bsc_applyEndpointCriteria(midpointsIn, [0 0 0], 'inferior') would output -% true values for all midpoints below y=0 (in acpc space). +% -varargin: interprets sequential triplets of inputs such that +% (1) a coordinate +% (2) a relative criteria +% (3) whether this criteria should apply to 'both', 'one', or 'neither' endpoint % -% ALTERNATIVE INPUT +% ALTERNATIVE INPUT for #1 % % instead of a coordinate a plane can be input. In such a case the plane -% will be interpreted as the singular value of he plane (i.e. the "narrow" +% will be interpreted as the singular value of the plane (i.e. the "narrow" % coordinate). % % OUTPUTS: -% -booleanOut: boolean vector indicating which midpoints meet all criteria +% -booleanOut: boolean vector indicating which streamlines meet all criteria % % (C) Daniel Bullock 2018 Bloomington % From c9379a3a57cc8517194ab147f28d6112f769ad28 Mon Sep 17 00:00:00 2001 From: Daniel Bullock Date: Fri, 10 Apr 2020 11:38:27 -0400 Subject: [PATCH 3/3] new version of category segmentation with implausable fibers --- Segmentations/bsc_segmentSuperficialFibers.m | 32 +-- .../bsc_streamlineCategoryPriors_v7.m | 268 ++++++++++++++++++ 2 files changed, 284 insertions(+), 16 deletions(-) create mode 100644 Segmentations/bsc_streamlineCategoryPriors_v7.m diff --git a/Segmentations/bsc_segmentSuperficialFibers.m b/Segmentations/bsc_segmentSuperficialFibers.m index 5ac51ec..37897fa 100644 --- a/Segmentations/bsc_segmentSuperficialFibers.m +++ b/Segmentations/bsc_segmentSuperficialFibers.m @@ -1,19 +1,19 @@ -function [classificationOut] =bsc_segmentSuperficialFibers(wbfg, atlas) -%[classificationOut] =bsc_segmentCingulum(wbfg, fsDir,varargin) +function [classificationOut] =bsc_segmentSuperficialFibers(wbfg, fsDir) +%[classificationOut] =bsc_streamlineCategoryPriors_v7(wbfg, fsDir,inflateITer) +% +% This function automatedly segments out superficial fibers in a +% tractogram. Here, we take supertifical to mean those streamlines which +% are close to the grey matter. We use this (along with a lenght criteria) +% to select putative u-fibers % -% This function automatedly segments the supercficial fibers. -% from a given whole brain fiber group using the subject's 2009 DK -% freesurfer parcellation. Subsections may come later. - % Inputs: % -wbfg: a whole brain fiber group structure % -fsDir: path to THIS SUBJECT'S freesurfer directory -% -varargin: priors from previous steps - +% % Outputs: % classificationOut: standardly constructed classification structure -% Same for the other tracts -% (C) Daniel Bullock, 2019, Indiana University +% +% (C) Daniel Bullock, 2020, Indiana University %% parameter note & initialization @@ -35,9 +35,9 @@ streamLengthLimit=30; -%atlas=fullfile(fsDir,'/mri/','aparc.a2009s+aseg.nii.gz'); +atlasPath=fullfile(fsDir,'/mri/','aparc.a2009s+aseg.nii.gz'); -[inflatedAtlas] =bsc_inflateLabels(atlas,2); +[inflatedAtlas] =bsc_inflateLabels(fsDir,2); greyMatterROIS=[[101:1:175]+12000 [101:1:175]+11000]; @@ -54,16 +54,16 @@ sidenum=10000+leftright*1000; wmROIDegrade=bsc_roiFromAtlasNums(inflatedAtlas,wmLut(leftright),1); - wmROIFull=bsc_roiFromAtlasNums(atlas,wmLut(leftright),1); + wmROIFull=bsc_roiFromAtlasNums(atlasPath,wmLut(leftright),1); if leftright==1 - OtherwmROIFull=bsc_roiFromAtlasNums(atlas,wmLut(2),5); + OtherwmROIFull=bsc_roiFromAtlasNums(atlasPath,wmLut(2),5); else - OtherwmROIFull=bsc_roiFromAtlasNums(atlas,wmLut(1),5); + OtherwmROIFull=bsc_roiFromAtlasNums(atlasPath,wmLut(1),5); end z = cellfun(@(x) sum(sqrt(sum((x(:, 1:end-1) - x(:, 2:end)) .^ 2))), wbfg.fibers, 'UniformOutput', true); - [superficialFibersDegrade, superficialFibersDegradeBool]=wma_SegmentFascicleFromConnectome(wbfg, [{wmROIDegrade} {OtherwmROIFull}], {'not','not'}, 'dud'); + [~, superficialFibersDegradeBool]=wma_SegmentFascicleFromConnectome(wbfg, [{wmROIDegrade} {OtherwmROIFull}], {'not','not'}, 'dud'); %[superficialFibersFull, superficialFibersFullBool]=wma_SegmentFascicleFromConnectome(wbfg, [{wmROIFull} {OtherwmROIFull}], {'not','not'}, 'dud'); diff --git a/Segmentations/bsc_streamlineCategoryPriors_v7.m b/Segmentations/bsc_streamlineCategoryPriors_v7.m new file mode 100644 index 0000000..26140c2 --- /dev/null +++ b/Segmentations/bsc_streamlineCategoryPriors_v7.m @@ -0,0 +1,268 @@ +function [classificationOut] =bsc_streamlineCategoryPriors_v7(wbfg, fsDir,inflateITer) +%[classificationOut] =bsc_streamlineCategoryPriors_v7(wbfg, fsDir,inflateITer) +% +% This function automatedly segments a whole brain tractogram into +% antomically based categories (fronto-frontal, etc). Provides a +% classificaiton structure that assigns category membership to each +% streamline. Serves as a good basis for coarse comparison between +% tractograms. Also serves as a good initial subcategorization of +% streamlines which can be used in subsequent segmentations +% +% Inputs: +% -wbfg: a whole brain fiber group structure +% -fsDir: path to THIS SUBJECT'S freesurfer directory +% -inflateITer: the number of inflation iterations to go through for the +% rois. This fills in islands/holes. Recommend 2. +% +% Outputs: +% classificationOut: standardly constructed classification structure +% +% (C) Daniel Bullock, 2020, Indiana University + +%% parameter note & initialization + +[superficialClassification] =bsc_segmentSuperficialFibers(wbfg, fsDir); + + + +greyMatterROIS=[[101:1:175]+12000 [101:1:175]+11000]; +leftROIS=[[101:1:175]+11000 26 17 18 7 8 10:13]; +rightROIS=[[101:1:175]+12000 46 47 49:54 58]; + +subcorticalROIS=[10:13 17:20 26 58 27 49:56 59 ]; +spineROIS=[16 28 60]; +cerebellumROIS=[8 47 7 46 ]; +ventricleROIS=[31 63 11 50 4 43 14 24 15 44 5 62 30 80 72 ]; +wmROIS=[41 2]; +ccROIS=[251:255]; +unknownROIS=[0 2000 1000 77:82 24 42 3]; +OpticCROI=[85]; + +FrontalROIs=[[124 148 118 165 101 154 105 115 154 155 115 170 129 146 153 ... + 164 106 116 108 131 171 112 150 104 169 114 113 116 107 163 139 132 140]+11000 [124 148 118 165 101 154 105 115 154 155 115 170 129 146 153 ... + 164 106 116 108 131 171 112 150 104 169 114 113 116 107 163 139 132 140]+12000] ; + +TemporalROIs=[[144 134 138 137 173 174 135 175 121 151 123 162 133]+11000 [144 134 138 137 173 174 135 175 121 151 123 162 133]+12000]; + +OccipitalROI=[[120 119 111 158 166 143 145 159 152 122 162 161 121 160 102]+11000 [120 119 111 158 166 143 145 159 152 122 162 161 121 160 102]+12000]; + +ParietalROI=[[157 127 168 136 126 125 156 128 141 172 147 109 103 130 110]+11000 [157 127 168 136 126 125 156 128 141 172 147 109 103 130 110]+12000]; + +pericROI=[[167]+11000 [167]+12000]; + +insulaROI=[[117 149]+11000 [117 149]+12000]; + +fprintf('\n rois set') + +atlasPath=fullfile(fsDir,'/mri/','aparc.a2009s+aseg.nii.gz'); + +if inflateITer>0 + [inflatedAtlas] =bsc_inflateLabels(fsDir,inflateITer); +else + inflatedAtlas=niftiRead(atlasPath); +end + + +%to account for streamlines that cross and then come back +leftROI=bsc_roiFromAtlasNums(inflatedAtlas,leftROIS,1); +rightROI=bsc_roiFromAtlasNums(inflatedAtlas,leftROIS,1); +[~, leftStreamsBool]=wma_SegmentFascicleFromConnectome(wbfg, {leftROI}, {'and'}, 'dud'); +[~, rightStreamsBool]=wma_SegmentFascicleFromConnectome(wbfg, {rightROI}, {'and'}, 'dud'); + +allStreams=wbfg.fibers; +clear wbfg +%initialize classification structure +classificationOut=[]; +classificationOut.names=[]; +classificationOut.index=zeros(length(allStreams),1); + + +classificationMid=classificationOut; + + +endpoints1=zeros(3,length(allStreams)); +endpoints2=zeros(3,length(allStreams)); + + +for icategories=1:length(allStreams) + curStream=allStreams{icategories}; + endpoints1(:,icategories)=curStream(:,1); + endpoints2(:,icategories)=curStream(:,end); +end + +fprintf('\n endpoints extracted') + + +[endpoints1Identity] =bsc_atlasROINumsFromCoords_v3(inflatedAtlas,endpoints1,'acpc'); +[endpoints2Identity] =bsc_atlasROINumsFromCoords_v3(inflatedAtlas,endpoints2,'acpc'); +fprintf('\n endpoint identities determined') + + +excludeBool=zeros(1,length(allStreams)); +includeBool=excludeBool; +LeftBool=excludeBool; +RightBool=excludeBool; +implausBool=excludeBool +interHemiBool=excludeBool; +validUIndexes=excludeBool; +bothSides=excludeBool; +singleLeftBoolproto=excludeBool; +singleRightBoolproto=excludeBool; +interhemiFlag=excludeBool; +termination2=cell(1,length(allStreams)); +termination1=cell(1,length(allStreams)); +streamName=termination1; + + + +fprintf('\n superficial fibers identified') + +validSideROI= [leftROIS rightROIS] ; +excludeSideROI=[unknownROIS pericROI ccROIS OpticCROI wmROIS spineROIS ventricleROIS]; + +for iStreams=1:length(allStreams) + %disagreeBool(iStreams)=or(and(rightStreamsBool(iStreams),and(ismember(endpoints2Identity(iStreams),leftROIS),ismember(endpoints1Identity(iStreams),leftROIS))),and(leftStreamsBool(iStreams),and(ismember(endpoints2Identity(iStreams),rightROIS),ismember(endpoints1Identity(iStreams),rightROIS)))) ; + excludeBool(iStreams)=or(ismember(endpoints2Identity(iStreams),excludeSideROI),ismember(endpoints1Identity(iStreams),excludeSideROI)); + includeBool(iStreams)=or(ismember(endpoints2Identity(iStreams),validSideROI),ismember(endpoints1Identity(iStreams),validSideROI)); + validUIndexes(iStreams)=or(ismember(endpoints2Identity(iStreams),greyMatterROIS),ismember(endpoints1Identity(iStreams),greyMatterROIS))&~excludeBool(iStreams); + LeftBool(iStreams)=and(ismember(endpoints2Identity(iStreams),leftROIS),ismember(endpoints1Identity(iStreams),leftROIS)); + RightBool(iStreams)=and(ismember(endpoints2Identity(iStreams),rightROIS),ismember(endpoints1Identity(iStreams),rightROIS)); + interHemiBool(iStreams)=or(and(ismember(endpoints2Identity(iStreams),leftROIS),ismember(endpoints1Identity(iStreams),rightROIS)),and(ismember(endpoints2Identity(iStreams),rightROIS),ismember(endpoints1Identity(iStreams),leftROIS))); + implausBool(iStreams)=and(~interHemiBool(iStreams),and(leftStreamsBool(iStreams),rightStreamsBool(iStreams))); + + + singleLeftBoolproto(iStreams)=xor(ismember(endpoints2Identity(iStreams),leftROIS),ismember(endpoints1Identity(iStreams),leftROIS)); + singleRightBoolproto(iStreams)=xor(ismember(endpoints2Identity(iStreams),rightROIS),ismember(endpoints1Identity(iStreams),rightROIS)); + + + + + if ~isempty(find(endpoints1Identity(iStreams)==FrontalROIs, 1)) + termination1{iStreams}='frontal'; + elseif ~isempty(find(endpoints1Identity(iStreams)==TemporalROIs, 1)) + termination1{iStreams}='temporal'; + elseif ~isempty(find(endpoints1Identity(iStreams)==OccipitalROI, 1)) + termination1{iStreams}='occipital'; + elseif ~isempty(find(endpoints1Identity(iStreams)==ParietalROI, 1)) + termination1{iStreams}='parietal'; + elseif ~isempty(find(endpoints1Identity(iStreams)==subcorticalROIS, 1)) + termination1{iStreams}='subcortical'; + elseif ~isempty(find(endpoints1Identity(iStreams)==spineROIS, 1)) + termination1{iStreams}='spinal'; + elseif ~isempty(find(endpoints1Identity(iStreams)==insulaROI, 1)) + termination1{iStreams}='insula'; + elseif ~isempty(find(endpoints1Identity(iStreams)==cerebellumROIS, 1)) + termination1{iStreams}='cerebellum'; + elseif ~isempty(find(endpoints1Identity(iStreams)==ccROIS, 1)) + termination1{iStreams}='CorpusCallosum'; + %false positives + elseif ~isempty(find(endpoints1Identity(iStreams)==ventricleROIS, 1)) + termination1{iStreams}='ventricle'; + elseif ~isempty(find(endpoints1Identity(iStreams)==unknownROIS, 1)) + termination1{iStreams}='unlabeled'; + elseif ~isempty(find(endpoints1Identity(iStreams)==wmROIS, 1)) + termination1{iStreams}='whiteMatter'; + elseif ~isempty(find(endpoints1Identity(iStreams)==pericROI, 1)) + termination1{iStreams}='pericallosal'; + elseif ~isempty(find(endpoints1Identity(iStreams)==OpticCROI, 1)) + termination1{iStreams}='OpticChi'; + end + + if ~isempty(find(endpoints2Identity(iStreams)==FrontalROIs, 1)) + termination2{iStreams}='frontal'; + elseif ~isempty(find(endpoints2Identity(iStreams)==TemporalROIs, 1)) + termination2{iStreams}='temporal'; + elseif ~isempty(find(endpoints2Identity(iStreams)==OccipitalROI, 1)) + termination2{iStreams}='occipital'; + elseif ~isempty(find(endpoints2Identity(iStreams)==ParietalROI, 1)) + termination2{iStreams}='parietal'; + elseif ~isempty(find(endpoints2Identity(iStreams)==subcorticalROIS, 1)) + termination2{iStreams}='subcortical'; + elseif ~isempty(find(endpoints2Identity(iStreams)==spineROIS, 1)) + termination2{iStreams}='spinal'; + elseif ~isempty(find(endpoints2Identity(iStreams)==insulaROI, 1)) + termination2{iStreams}='insula'; + elseif ~isempty(find(endpoints2Identity(iStreams)==cerebellumROIS, 1)) + termination2{iStreams}='cerebellum'; + %false positives + elseif ~isempty(find(endpoints2Identity(iStreams)==pericROI, 1)) + termination2{iStreams}='pericallosal'; + elseif ~isempty(find(endpoints2Identity(iStreams)==ventricleROIS, 1)) + termination2{iStreams}='ventricle'; + elseif ~isempty(find(endpoints2Identity(iStreams)==unknownROIS, 1)) + termination2{iStreams}='unlabeled'; + elseif ~isempty(find(endpoints2Identity(iStreams)==wmROIS, 1)) + termination2{iStreams}='whiteMatter'; + elseif ~isempty(find(endpoints2Identity(iStreams)==ccROIS, 1)) + termination2{iStreams}='CorpusCallosum'; + elseif ~isempty(find(endpoints2Identity(iStreams)==OpticCROI, 1)) + termination2{iStreams}='OpticChi'; + end + + + if ~or(isempty(termination1{iStreams}),isempty(termination2{iStreams})) + terminationNames=sort({termination1{iStreams} termination2{iStreams}}); + else + endpoints1Identity(iStreams) + endpoints2Identity(iStreams) + error('streamline identity unaccounted for') + end + + + + %hierarchy of categories here + interhemiFlag(iStreams)=interHemiBool(iStreams)&includeBool(iStreams); + if interhemiFlag(iStreams) + streamName{iStreams}=strcat(terminationNames{1},'_to_',terminationNames{2},'_interHemi'); + else + streamName{iStreams}=strcat(terminationNames{1},'_to_',terminationNames{2}); + end + + + if superficialClassification.index(iStreams)>0&validUIndexes(iStreams) + streamName{iStreams}=strcat(terminationNames{1},'_to_',terminationNames{2},'_ufiber'); + end + + if or(LeftBool(iStreams),singleLeftBoolproto(iStreams))&includeBool(iStreams)&~interhemiFlag(iStreams) + streamName{iStreams}=strcat('left',streamName{iStreams}); + elseif or(RightBool(iStreams),singleRightBoolproto(iStreams))&includeBool(iStreams)&~interhemiFlag(iStreams) + streamName{iStreams}=strcat('right',streamName{iStreams}); + end + + if interhemiFlag(iStreams)&validUIndexes(iStreams)&~superficialClassification.index(iStreams)==0 + streamName{iStreams}=strcat('MaskFailure'); + end + + if implausBool(iStreams) + streamName{iStreams}=strcat(streamName{iStreams},'_implausable'); + else + %do nothing + end + +end + +uniqueNames=unique(streamName); + +fprintf('\n %i endpoint categories determined', length(uniqueNames)) + +summarizeNames={'CorpusCallosum' 'unlabeled' 'OpticChi' 'ventricle' 'whiteMatter' 'pericallosal'}; + +for icategories=1:length(uniqueNames) + + if contains(uniqueNames{icategories},summarizeNames) + for isummary=1:length(summarizeNames) + summaryIndex(isummary)=contains(uniqueNames{icategories},summarizeNames{isummary}); + end + summaryIndexSingle=find(summaryIndex); + classificationOut=bsc_concatClassificationCriteria(classificationOut,summarizeNames{summaryIndexSingle(1)},contains(streamName,uniqueNames{icategories})); + clear summaryIndex + else + classificationOut=bsc_concatClassificationCriteria(classificationOut,uniqueNames{icategories},ismember(streamName,uniqueNames{icategories})); + end +end + + +classificationOut = wma_resortClassificationStruc(classificationOut); + +fprintf('\n categorical segmentation complete') +end \ No newline at end of file