<commit_before><?php

class DcmExport
{
	public static function dcm2png($srcFname, $dstFname, $windowLevel, $windowWidth)
	{
		// validation
		if(!is_numeric($windowLevel) || $windowLevel < -10000 || $windowLevel > 10000)  $windowLevel = 0;
		if(!is_numeric($windowWidth) || $windowWidth < 0      || $windowWidth > 20000)  $windowWidth = 0;

		global $cmdForProcess, $cmdDcmToPng;	// refer common.php

		if(is_file($srcFname))
		{
			$cmdStr = sprintf('%s "%s %s %s %d %d"', $cmdForProcess, $cmdDcmToPng, $srcFname, $dstFname, $windowLevel, $windowWidth);
			shell_exec($cmdStr);

			for($i=0; $i<100; $i++)
			{
				if(is_file($dstFname))	return true;
				else					sleep(1);
			}
		}
		return false;
	}

	// CreateThumbnail
	public static function createThumbnailJpg($srcFname, $dstFname, $dumpFname, $quality,
												$windowLevel, $windowWidth, $imgWidth, $imgHeight)
	{
		global $cmdForProcess, $cmdCreateThumbnail;	// refer common.php

		//$cmdStr = sprintf('%s "%s %s %s %d %d %d %d %d %s"', $cmdForProcess, $cmdCreateThumbnail, $srcFname, $dstFname,
		//												 $quality, $windowLevel, $windowWidth, $imgWidth, $imgHeight,
		//												 $dumpFname);

		$cmdStr = sprintf('%s %s %s %d %d %d %d %d %s', $cmdCreateThumbnail, $srcFname, $dstFname,
														$quality, $windowLevel, $windowWidth, $imgWidth, $imgHeight,
														$dumpFname);

		//throw new Exception($cmdStr);
		shell_exec($cmdStr);

		for($i=0; $i<100; $i++)
		{
			if(is_file($dstFname))	return true;
			else                    sleep(1);
		}
		return false;
	}
}
?><commit_msg>Create thumbnail image waits for file creation no longer than 5 seconds<commit_after><?php

class DcmExport
{
	public static function dcm2png($srcFname, $dstFname, $windowLevel, $windowWidth)
	{
		// validation
		if(!is_numeric($windowLevel) || $windowLevel < -10000 || $windowLevel > 10000)  $windowLevel = 0;
		if(!is_numeric($windowWidth) || $windowWidth < 0      || $windowWidth > 20000)  $windowWidth = 0;

		global $cmdForProcess, $cmdDcmToPng;	// refer common.php

		if(is_file($srcFname))
		{
			$cmdStr = sprintf('%s "%s %s %s %d %d"', $cmdForProcess, $cmdDcmToPng, $srcFname, $dstFname, $windowLevel, $windowWidth);
			shell_exec($cmdStr);

			for($i=0; $i<5; $i++)
			{
				if(is_file($dstFname))
					return true;
				else
					sleep(1);
			}
		}
		return false;
	}

	// CreateThumbnail
	public static function createThumbnailJpg($srcFname, $dstFname, $dumpFname, $quality,
												$windowLevel, $windowWidth, $imgWidth, $imgHeight)
	{
		global $cmdForProcess, $cmdCreateThumbnail;	// refer common.php

		//$cmdStr = sprintf('%s "%s %s %s %d %d %d %d %d %s"', $cmdForProcess, $cmdCreateThumbnail, $srcFname, $dstFname,
		//												 $quality, $windowLevel, $windowWidth, $imgWidth, $imgHeight,
		//												 $dumpFname);

		$cmdStr = sprintf('%s %s %s %d %d %d %d %d %s', $cmdCreateThumbnail, $srcFname, $dstFname,
														$quality, $windowLevel, $windowWidth, $imgWidth, $imgHeight,
														$dumpFname);

		//throw new Exception($cmdStr);
		shell_exec($cmdStr);

		for($i=0; $i<5; $i++)
		{
			if(is_file($dstFname))
				return true;
			else
				sleep(1);
		}
		return false;
	}
}
?>
{'fraction_non_alphanumeric': 0.16630059617194853, 'fraction_numerical': 0.01725760903671164, 'mean_word_length': 3.4712482468443198, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '939136', 'n_tokens_mistral': 1454, 'n_tokens_neox': 1203, 'n_words': 263}