Concentric Density Distribution 4% site - Image Rotation issues

Dear Forum,

Firstly, thanks Timo for this great Plugin.

I have just started to analyse a few thousand children’s distal 4% sites of the Radius and Tibia using the concentric density option. The images were acquired using a Stratec XCT 2000. I have separated my analysis so that I batch process either the Left or Right side, however I am finding that the plugin is inconsistently rotating my images. My scans are all acquired using the default Stratec positioning devices so the acquisition angles shouldn’t vary dramatically for most scans.

Looking at the results obtained for about 900 left radius images, my average Alpha [deg] was 11 and the range was -89.9 to 89.9

I have changed my settings for the Radius to use “All bones Imax/Imin” and this has improved my success rate but am wondering if there is any chance to enhance analysis plugin to:

  1. Be able to designate the side being analysed to limit negative rotation/stop Image flipping?
    The “Guess Right” for the right radius attempt did help a bit but a “Force right” may work better?
  2. Incorporate the orientation of the maximum soft tissue diameter to aid with more consistent determination of bone orientation?
    In my scans, the tibia soft tissue maximum is in the anterior-posterior orientation, whilst for the radius, the maximum diameter medial-lateral.

I am hoping to also go on to use the other density distribution function for the 65% site. With the more circular radius at this site, again the soft tissue cross-section may assist with determining bone orientation?

I am happy to provide some test images if required.

Much appreciated.

Julie

Follow on to my previous comment, after looking at the code, I see tissue cross-section has already been taken into account. Will consider other options…:thinking:

You didn’t link to it, but I assume this is the plugin you are talking about.

Also, I suggest to mention @tjrantal to make sure he gets notified about your topic. I hope he or someone from the BoneJ team (@mdoube, @rimadoma) will be able to answer your questions.

1 Like

Dear Julie,

I’ve started aligning scans based on both bones (not based on imax/imin but the line between bone area centres) and would recommend that approach. This would be the (not_)Selected_to_right option.

You shouldn’t have to separate left and right limb scans manually (for bone sites with two bones visible that is), with appropriate cues (boxes ticked), I’ve always had perfect classification of body side. For example, I’ve ticked guess flip, guess right and stacked bones for distal radius in my latest batch of analysis. I’ve pasted below the ImageJ macros for 4% and 66% radius analysis I used in my most recent batch run, hopefully those will be helpful in sorting this out. The lines starting with ‘parameterString =’ are the ones that contain pertinent information (i.e. the boxes that you’d need to tick).

On a somewhat related note, I am in the middle of moving continents (from Oz to Finland to be precise) so I will not be necessarily likely to be able respond to any follow-ups in a timely manner.

Sincerely,
-Timo

ImageJ macros:

macro "DistalRadius"{
	resultsDir = "c:/path/here/";

	setBatchMode(true);

	
	//rad4
	boneSite = "rad4";
	saveBoneSite = "rad4";
		parameterString = "  air_threshold=-40.0 fat=40.0 muscle_threshold=40.0 marrow_threshold=80 soft_tissue_threshold=200 rotation_threshold=169.000 area=169.0000 bmd=169.0000 roi_selection=Bigger soft_tissue_roi_selection=Bigger rotation_selection=Not_selected_to_right analyse_cortical_results analyse_mass_distribution analyse_concentric_density_distribution allow_cleaving suppress_result_image guess_flip guess_right stacked_bones";
	analyseFiles(boneSite,saveBoneSite,resultsDir,parameterString);
	
	//ulna4
	
	boneSite = "rad4";
	saveBoneSite = "ulna4";
	parameterString = "  air_threshold=-40.0 fat=40.0 muscle_threshold=40.0 marrow_threshold=80 soft_tissue_threshold=200 rotation_threshold=169.000 area=169.0000 bmd=169.0000 roi_selection=SecondLargest soft_tissue_roi_selection=Bigger rotation_selection=Selected_to_right analyse_cortical_results analyse_mass_distribution analyse_concentric_density_distribution allow_cleaving suppress_result_image guess_flip guess_larger stacked_bones";
	analyseFiles(boneSite,saveBoneSite,resultsDir,parameterString);
	setBatchMode(false);
	
}

	//FUNCTION TO ANALYSE FILES
	function analyseFiles(boneSite,saveBoneSite,resultsDir,parameterString){
		sourceDir = resultsDir+"data/"+boneSite+"/";
		visualDir = resultsDir+"visual/"+saveBoneSite+"/";
		saveName = "results/"+saveBoneSite+".xls";
		parameters = parameterString+" "+"save_visual_result_image_on_disk image_save_path="+visualDir;
		files = getFileList(sourceDir);
		//IJ.log("Analyysiin "+files.length+" tiedostoa");
		//IJ.log(sourceDir);
		//IJ.log(visualDir);
		//IJ.log(saveName);
		for (i =0; i<files.length;++i){//i<1;++i){//
			showProgress(i+1, files.length);
			if(startsWith(files[i],"I00")){
				run("Stratec pQCT", "select="+sourceDir+files[i]);
				run("Distribution Analysis", parameters);
				close();
			}
			while(isOpen("Exception")){
				selectWindow("Exception");
				run("Close");
			}
		}
		selectWindow("Results");
		saveAs("Results", resultsDir+saveName);
		while (isOpen("Results")){
			selectWindow("Results");
			run("Close");	
		}
		while(isOpen("Exception")){
			selectWindow("Exception");
			run("Close");
		}

	}
macro "RadialShaft"{
	resultsDir = "c:/path/here/";

	setBatchMode(true);

	
	///rad60
	boneSite = "rad66";
	saveBoneSite = "rad66";
	parameterString = "  air_threshold=-40.0 fat=40.0 muscle_threshold=40.0 marrow_threshold=80 soft_tissue_threshold=200 rotation_threshold=280.000 area=480.0000 bmd=710.0000 roi_selection=Central rotation_selection=Not_selected_to_right  analyse_cortical_results analyse_mass_distribution analyse_density_distribution analyse_soft_tissues suppress_result_image guess_right stacked_bones";
	analyseFiles(boneSite,saveBoneSite,resultsDir,parameterString);
	

	//Ulna60
	boneSite = "rad66";
	saveBoneSite = "ulna66";
	parameterString = " air_threshold=-40.0 fat=40.0 muscle_threshold=40.0 marrow_threshold=80 soft_tissue_threshold=200 rotation_threshold=280.000 area=480.0000 bmd=710.0000 roi_selection=Peripheral rotation_selection=Selected_to_right analyse_cortical_results analyse_mass_distribution analyse_density_distribution suppress_result_image guess_right stacked_bones invert_flip_guess";
	analyseFiles(boneSite,saveBoneSite,resultsDir,parameterString);

	setBatchMode(false);
}

	//FUNCTION TO ANALYSE FILES
	function analyseFiles(boneSite,saveBoneSite,resultsDir,parameterString){
		sourceDir = resultsDir+"data/"+boneSite+"/";
		visualDir = resultsDir+"visual/"+saveBoneSite+"/";
		saveName = "results/"+saveBoneSite+".xls";
		parameters = parameterString+" "+"save_visual_result_image_on_disk image_save_path="+visualDir;
		files = getFileList(sourceDir);
		//IJ.log("Analyysiin "+files.length+" tiedostoa");
		//IJ.log(sourceDir);
		//IJ.log(visualDir);
		//IJ.log(saveName);
		for (i =0; i<files.length;++i){//i<1;++i){//
			showProgress(i+1, files.length);
			if(startsWith(files[i],"I00")){
				run("Stratec pQCT", "select="+sourceDir+files[i]);
				run("Distribution Analysis", parameters);
				close();
			}
			while(isOpen("Exception")){
				selectWindow("Exception");
				run("Close");
			}
		}
		selectWindow("Results");
		saveAs("Results", resultsDir+saveName);
		while (isOpen("Results")){
			selectWindow("Results");
			run("Close");	
		}
		while(isOpen("Exception")){
			selectWindow("Exception");
			run("Close");
		}

	}
2 Likes

Dear Timo,

Thank you so much for your rapid response and assistance.

Hope your move goes well.

Julie

Apologies @imagejan about the poor message details/quality. Will try to do better in the future. Thanks to your guesswork the message got through :slight_smile: