/// <summary> /// Return image profiles through plan isocenter in primary axis direction /// </summary> /// <param name="plan">TPS.NET.Plan</param> /// <param name="profileLengthInmm"> length of the profiles in mm</param> /// <returns></returns> public static (ImageProfile, ImageProfile, ImageProfile) getImageProfilesThroughIsocenter(PlanSetup plan) { var image = plan.StructureSet.Image; var dirVecs = new VVector[] { plan.StructureSet.Image.XDirection, plan.StructureSet.Image.YDirection, plan.StructureSet.Image.ZDirection }; var steps = new double[] { plan.StructureSet.Image.XRes, plan.StructureSet.Image.YRes, plan.StructureSet.Image.ZRes }; var planIso = plan.Beams.First().IsocenterPosition; var tmpRes = new ImageProfile[3]; // // Throws if plan does not have 'BODY' // var body = plan.StructureSet.Structures.Single(st => st.Id == "BODY"); for (int ind = 0; ind < 3; ind++) { (var startPoint, var endPoint) = Helpers.GetStructureEntryAndExit(body, dirVecs[ind], planIso, steps[ind]); var samples = (int)Math.Ceiling((endPoint - startPoint).Length / steps[ind]); tmpRes[ind] = image.GetImageProfile(startPoint, endPoint, new double[samples]); } return(tmpRes[0], tmpRes[1], tmpRes[2]); }
public void Test_ToByteArray() { using (IMagickImage image = new MagickImage(Files.FujiFilmFinePixS1ProJPG)) { ImageProfile profile = image.GetIptcProfile(); Assert.IsNotNull(profile); Assert.AreEqual(273, profile.ToByteArray().Length); } }
public ActionResult <User> UpdateUser(int id, ImageProfile profile) { var userTemp = _repo.GetUserById(id); if (userTemp == null) { return(NotFound()); } _repo.UpdateUserProfile(userTemp, profile.ImgProfile); return(Ok(userTemp)); }
private static void Test_Ping(IMagickImageCollection collection) { Assert.AreEqual(1, collection.Count); ExceptionAssert.Throws <InvalidOperationException>(delegate() { collection[0].GetPixels(); }); ImageProfile profile = collection[0].Get8BimProfile(); Assert.IsNotNull(profile); }
protected override void OnInit(EventArgs e) { base.OnInit(e); Image = !string.IsNullOrEmpty(Request["imageid"]) ? BLL.Image.GetImage(Convert.ToInt32(Request.QueryString["imageid"])) : null; ImageProfile = !string.IsNullOrEmpty(Request["profileid"]) ? BLL.ImageProfile.ReadProfile(Convert.ToInt32(Request.QueryString["profileid"])) : null; if (Image == null) { RequiresAuthorization(Authorizations.SearchImage); } else { RequiresAuthorizationOrManagedImage(Authorizations.ReadImage, Image.Id); } }
public void Test_Ping() { using (MagickImage image = new MagickImage()) { image.Ping(Files.FujiFilmFinePixS1ProJPG); ExceptionAssert.Throws <MagickCacheErrorException>(delegate() { image.GetReadOnlyPixels(); }); ImageProfile profile = image.GetExifProfile(); Assert.IsNotNull(profile); } }
public void Test_Profile() { using (MagickImage image = new MagickImage(Files.FujiFilmFinePixS1ProJPG)) { ImageProfile profile = image.GetExifProfile(); Assert.IsNotNull(profile); image.RemoveProfile(profile.Name); profile = image.GetExifProfile(); Assert.IsNull(profile); using (MemoryStream memStream = new MemoryStream()) { image.Write(memStream); memStream.Position = 0; using (MagickImage newImage = new MagickImage(memStream)) { profile = newImage.GetExifProfile(); Assert.IsNull(profile); } } } }
public void Test_IEquatable() { using (IMagickImage image = new MagickImage(Files.FujiFilmFinePixS1ProJPG)) { ImageProfile first = image.GetIptcProfile(); Assert.IsFalse(first == null); Assert.IsFalse(first.Equals(null)); Assert.IsTrue(first.Equals(first)); Assert.IsTrue(first.Equals((object)first)); ImageProfile second = image.GetIptcProfile(); Assert.IsNotNull(second); Assert.IsTrue(first == second); Assert.IsTrue(first.Equals(second)); Assert.IsTrue(first.Equals((object)second)); second = new IptcProfile(new byte[] { 0 }); Assert.IsTrue(first != second); Assert.IsFalse(first.Equals(second)); } }
public string Start() { if (_computer == null) { return("The Computer Does Not Exist"); } _imageProfile = ImageProfile.ReadProfile(_computer.ImageProfileId); if (_imageProfile == null) { return("The Image Profile Does Not Exist"); } if (_imageProfile.Image == null) { return("The Image Does Not Exist"); } if (_direction == "push" || _direction == "permanent_push") { var validation = Image.CheckApprovalAndChecksum(_imageProfile.Image, _userId); if (!validation.IsValid) { return(validation.Message); } } var dp = BLL.DistributionPoint.GetPrimaryDistributionPoint(); if (dp == null) { return("Could Not Find A Primary Distribution Point"); } if (ActiveImagingTask.IsComputerActive(_computer.Id)) { return("This Computer Is Already Part Of An Active Task"); } _activeTask = new Models.ActiveImagingTask { ComputerId = _computer.Id, Direction = _direction, UserId = _userId }; _activeTask.Type = _direction == "permanent_push" ? "permanent_push" : "unicast"; if (!ActiveImagingTask.AddActiveImagingTask(_activeTask)) { return("Could Not Create The Database Entry For This Task"); } if (!new TaskBootMenu(_computer, _imageProfile, _direction).CreatePxeBootFiles()) { ActiveImagingTask.DeleteActiveImagingTask(_activeTask.Id); return("Could Not Create PXE Boot File"); } _activeTask.Arguments = new CreateTaskArguments(_computer, _imageProfile, _direction).Run(); if (!ActiveImagingTask.UpdateActiveImagingTask(_activeTask)) { ActiveImagingTask.DeleteActiveImagingTask(_activeTask.Id); return("Could Not Create Task Arguments"); } Utility.WakeUp(_computer.Mac); return("Successfully Started Task For " + _computer.Name); }
public string Create() { _imageProfile = ImageProfile.ReadProfile(_group.ImageProfileId); if (_imageProfile == null) { return("The Image Profile Does Not Exist"); } if (_imageProfile.Image == null) { return("The Image Does Not Exist"); } var validation = Image.CheckApprovalAndChecksum(_imageProfile.Image, _userId); if (!validation.IsValid) { return(validation.Message); } _multicastSession.Port = Port.GetNextPort(); if (_multicastSession.Port == 0) { return("Could Not Determine Current Port Base"); } var dp = BLL.DistributionPoint.GetPrimaryDistributionPoint(); if (dp == null) { return("Could Not Find A Primary Distribution Point"); } _multicastSession.UserId = _userId; //End of the road for starting an on demand multicast if (_isOnDemand) { _multicastSession.Name = _group.Name; _group.Name = _multicastSession.Port.ToString(); if (!StartMulticastSender()) { return("Could Not Start The Multicast Application"); } else { return("Successfully Started Multicast " + _group.Name); } } //Continue On If multicast is for a group _multicastSession.Name = _group.Name; _computers = Group.GetGroupMembers(_group.Id); if (_computers.Count < 1) { return("The group Does Not Have Any Members"); } if (!ActiveMulticastSession.AddActiveMulticastSession(_multicastSession)) { return("Could Not Create Multicast Database Task. An Existing Task May Be Running."); } if (!CreateComputerTasks()) { ActiveMulticastSession.Delete(_multicastSession.Id); return("Could Not Create Computer Database Tasks. A Computer May Have An Existing Task."); } if (!CreatePxeFiles()) { ActiveMulticastSession.Delete(_multicastSession.Id); return("Could Not Create Computer Boot Files"); } if (!CreateTaskArguments()) { ActiveMulticastSession.Delete(_multicastSession.Id); return("Could Not Create Computer Task Arguments"); } if (!StartMulticastSender()) { ActiveMulticastSession.Delete(_multicastSession.Id); return("Could Not Start The Multicast Application"); } foreach (var computer in _computers) { Utility.WakeUp(computer.Mac); } return("Successfully Started Multicast " + _group.Name); }