protected override void OnEnable() { base.OnEnable(); ImageLocalizer.ExecLocalizeImage(this, _imagePath, _imageExt, _imageFolder); ImageLocalizer.RegisterImage(this, _imagePath, _imageExt, _imageFolder); }
protected override void Start() { base.Start(); _languageType = ImageLocalizer.GetDefaultLanguageType(); ImageLocalizer.ExecLocalizeImage(this, _imagePath, _imageExt, _imageFolder); }
private void OnDestroy() { OnLocalizeImage = null; OnRefreshAllImage = null; _allLocalizerImage.Clear(); _instance = null; }
public static void Initialize(int languageType) { if (_instance == null) { _instance = new GameObject("ImageLocalizer").AddComponent <ImageLocalizer>(); } _instance._languageType = languageType; }
public void FrameGeometry_CalculateLocalizer_OrthogonalIntersecting() { var frameofreferenceuid = DicomUIDGenerator.GenerateDerivedFromUUID(); var source = new DicomDataset(); source.AddOrUpdate(DicomTag.ImagePositionPatient, 0.0m, 0.0m, 0.0m); source.AddOrUpdate(DicomTag.ImageOrientationPatient, 1.0m, 0.0m, 0.0m, 0.0m, 1.0m, 0.0m); source.AddOrUpdate(DicomTag.PixelSpacing, 0.5m, 0.5m); source.AddOrUpdate(DicomTag.Rows, (ushort)500); source.AddOrUpdate(DicomTag.Columns, (ushort)500); source.AddOrUpdate(DicomTag.FrameOfReferenceUID, frameofreferenceuid); var destination = new DicomDataset(); destination.AddOrUpdate(DicomTag.ImagePositionPatient, 50.0m, 100.0m, -50.0m); destination.AddOrUpdate(DicomTag.ImageOrientationPatient, 1.0m, 0.0m, 0.0m, 0.0m, 0.0m, 1.0m); destination.AddOrUpdate(DicomTag.PixelSpacing, 0.25m, 0.25m); destination.AddOrUpdate(DicomTag.Rows, (ushort)600); destination.AddOrUpdate(DicomTag.Columns, (ushort)600); destination.AddOrUpdate(DicomTag.FrameOfReferenceUID, frameofreferenceuid); // CalculateIntersectionLocalizer var sourcegeometry = new FrameGeometry(source); var destinationgeometry = new FrameGeometry(destination); Assert.True(ImageLocalizer.CanDrawLocalizer(sourcegeometry, destinationgeometry)); Assert.False(ImageLocalizer.CanDrawLocalizer(sourcegeometry, sourcegeometry)); var ok = ImageLocalizer.CalcualteIntersectionLocalizer(sourcegeometry, destinationgeometry, out var startPoint, out var endPoint); Assert.True(ok); Assert.Equal(new Point2(800, 200), startPoint); Assert.Equal(new Point2(-200, 200), endPoint); ok = ImageLocalizer.CalcualteIntersectionLocalizer(destinationgeometry, sourcegeometry, out startPoint, out endPoint); Assert.True(ok); Assert.Equal(new Point2(400, 200), startPoint); Assert.Equal(new Point2(100, 200), endPoint); // calculateProjectionLocalizer ImageLocalizer.CalcualteProjectionLocalizer(source, destination, out var points); Assert.Equal(4, points.Count); Assert.Equal(new Point2(-200, 200), points[0]); Assert.Equal(new Point2(796, 200), points[1]); Assert.Equal(new Point2(796, 200), points[2]); Assert.Equal(new Point2(-200, 200), points[3]); ImageLocalizer.CalcualteProjectionLocalizer(destination, source, out points); Assert.Equal(4, points.Count); Assert.Equal(new Point2(100, 200), points[0]); Assert.Equal(new Point2(398, 200), points[1]); Assert.Equal(new Point2(398, 200), points[2]); Assert.Equal(new Point2(100, 200), points[3]); }
public List <Subject> Acquire(int totalDesired, List <String> urls) { ImageLocalizer localizer = new ImageLocalizer(new Queue <string>(urls), totalDesired); List <DownloadedImage> results = localizer.Download(); List <Subject> subjects = new List <Subject>(); foreach (DownloadedImage dl in results) { subjects.Add(new Subject(dl.Url, dl.Image)); } return(subjects); }
protected override void OnDestroy() { ImageLocalizer.UnRegisterImage(this); base.OnDestroy(); }
// Use this for initialization void Awake() { _instance = this; DontDestroyOnLoad(gameObject); }