/// <summary> /// Loads the Squirrel model and textures /// into the algorithms and textures /// </summary> public void loadSquirrel() { //Set a predefined position for the eyes //that matches the .blend file eyeX = 0.076; eyeY = -0.178; eyeZ = 0.675; //load the squirrel model and textures if //they are not already loaded if (!squirrelLoaded) { squirrelReader.SetFileName("../../../models/squirrel.vtk"); squirrelReader.Update(); squirrelEyeReader.SetFileName("../../../models/squirrel_eyeR.vtk"); squirrelEyeReader.Update(); squirrelEyeReader2.SetFileName("../../../models/squirrel_eyeL.vtk"); squirrelEyeReader2.Update(); squirrelColorReader.SetFileName("../../../textures/squirrel_skin_col.png"); squirrelColorReader.Update(); squirrelEyeColorReader.SetFileName("../../../textures/squirrel_eyeR.png"); squirrelEyeColorReader.Update(); squirrelEyeColorReader2.SetFileName("../../../textures/squirrel_eyeL.png"); squirrelEyeColorReader2.Update(); squirrelLoaded = true; } //Set the algorithms and textures to the //ouput of the readers eyeColorTexture1.InterpolateOn(); eyeColorTexture1.SetInputConnection(squirrelEyeColorReader.GetOutputPort()); deciEyeColorTexture1.InterpolateOn(); deciEyeColorTexture1.SetInputConnection(squirrelEyeColorReader.GetOutputPort()); eyeColorTexture2.InterpolateOn(); eyeColorTexture2.SetInputConnection(squirrelEyeColorReader2.GetOutputPort()); deciEyeColorTexture2.InterpolateOn(); deciEyeColorTexture2.SetInputConnection(squirrelEyeColorReader2.GetOutputPort()); animalColorTexture.InterpolateOn(); animalColorTexture.SetInputConnection(squirrelColorReader.GetOutputPort()); deciAnimalColorTexture.InterpolateOn(); deciAnimalColorTexture.SetInputConnection(squirrelColorReader.GetOutputPort()); eyeData2 = squirrelEyeReader2.GetOutputPort(); eyeData1 = squirrelEyeReader.GetOutputPort(); animalData = squirrelReader.GetOutputPort(); }
/// <summary> /// Loads the Chinchilla model and textures /// into the algorithms and textures /// </summary> public void loadChinchilla() { //Set a predefined position for the eyes //that matches the .blend file eyeX = 0.052; eyeY = -0.144; eyeZ = 0.424; //load the chinchilla model and textures if //they are not already loaded if (!chinchillaLoaded) { chinchillaReader.SetFileName("../../../models/chinchilla.vtk"); chinchillaReader.Update(); chinchillaEyeReader.SetFileName("../../../models/chinchilla_eye.vtk"); chinchillaEyeReader.Update(); chinchillaColorReader.SetFileName("../../../textures/chinchilla_skin_col.png"); chinchillaColorReader.Update(); chinchillaEyeColorReader.SetFileName("../../../textures/chinchilla_eye.png"); chinchillaEyeColorReader.Update(); chinchillaLoaded = true; } //Set the algorithms and textures to the //ouput of the readers animalData = chinchillaReader.GetOutputPort(); eyeData1 = chinchillaEyeReader.GetOutputPort(); eyeData2 = eyeData1; animalColorTexture.InterpolateOn(); animalColorTexture.SetInputConnection(chinchillaColorReader.GetOutputPort()); deciAnimalColorTexture.InterpolateOn(); deciAnimalColorTexture.SetInputConnection(chinchillaColorReader.GetOutputPort()); eyeColorTexture1.InterpolateOn(); eyeColorTexture1.SetInputConnection(chinchillaEyeColorReader.GetOutputPort()); deciEyeColorTexture1.InterpolateOn(); deciEyeColorTexture1.SetInputConnection(chinchillaEyeColorReader.GetOutputPort()); eyeColorTexture2.InterpolateOn(); eyeColorTexture2.SetInputConnection(chinchillaEyeColorReader.GetOutputPort()); deciEyeColorTexture2.InterpolateOn(); deciEyeColorTexture2.SetInputConnection(chinchillaEyeColorReader.GetOutputPort()); }
/// <summary> /// Loads the Flying Squirrel model and textures /// into the algorithms and textures /// </summary> public void loadFlyingSquirrel() { //Set a predefined position for the eyes //that matches the .blend file eyeX = 0.054; eyeY = -0.189; eyeZ = 0.427; //load the flyingsquirrel model and textures if //they are not already loaded if (!flyingSquirrelLoaded) { flyingSquirrelReader.SetFileName("../../../models/flyingsquirrel.vtk"); flyingSquirrelReader.Update(); flyingSquirreleyeReader.SetFileName("../../../models/flyingsquirrel_eye.vtk"); flyingSquirreleyeReader.Update(); flyingSquirrelColorReader.SetFileName("../../../textures/flyingsquirrel_skin_col.png"); flyingSquirrelColorReader.Update(); flyingSquirrelEyeColorReader.SetFileName("../../../textures/flyingsquirrel_eye.png"); flyingSquirrelEyeColorReader.Update(); flyingSquirrelLoaded = true; } //Set the algorithms and textures to the //ouput of the readers animalData = flyingSquirrelReader.GetOutputPort(); eyeData1 = flyingSquirreleyeReader.GetOutputPort(); eyeData2 = eyeData1; animalColorTexture.InterpolateOn(); animalColorTexture.SetInputConnection(flyingSquirrelColorReader.GetOutputPort()); deciAnimalColorTexture.InterpolateOn(); deciAnimalColorTexture.SetInputConnection(flyingSquirrelColorReader.GetOutputPort()); eyeColorTexture1.InterpolateOn(); eyeColorTexture1.SetInputConnection(flyingSquirrelEyeColorReader.GetOutputPort()); deciEyeColorTexture1.InterpolateOn(); deciEyeColorTexture1.SetInputConnection(flyingSquirrelEyeColorReader.GetOutputPort()); eyeColorTexture2.InterpolateOn(); eyeColorTexture2.SetInputConnection(flyingSquirrelEyeColorReader.GetOutputPort()); deciEyeColorTexture2.InterpolateOn(); deciEyeColorTexture2.SetInputConnection(flyingSquirrelEyeColorReader.GetOutputPort()); }
/// <summary> /// Loads the Rabbit model and textures /// into the algorithms and textures /// </summary> public void loadRabbit() { //Set a predefined position for the eyes //that matches the .blend file eyeX = 0.057; eyeY = -0.311; eyeZ = 1.879; //load the rabbit model and textures if //they are not already loaded if (!rabbitLoaded) { rabbitReader.SetFileName("../../../models/rabbit.vtk"); rabbitReader.Update(); eyeReader.SetFileName("../../../models/rabbit_eye.vtk"); eyeReader.Update(); rabbitColorReader.SetFileName("../../../textures/rabbit_skin_col.png"); rabbitColorReader.Update(); eyeColorReader.SetFileName("../../../textures/rabbit_eye.png"); eyeColorReader.Update(); rabbitLoaded = true; } //Set the algorithms and textures to the //ouput of the readers animalData = rabbitReader.GetOutputPort(); eyeData1 = eyeReader.GetOutputPort(); eyeData2 = eyeData1; animalColorTexture.InterpolateOn(); animalColorTexture.SetInputConnection(rabbitColorReader.GetOutputPort()); deciAnimalColorTexture.InterpolateOn(); deciAnimalColorTexture.SetInputConnection(rabbitColorReader.GetOutputPort()); eyeColorTexture1.InterpolateOn(); eyeColorTexture1.SetInputConnection(eyeColorReader.GetOutputPort()); deciEyeColorTexture1.InterpolateOn(); deciEyeColorTexture1.SetInputConnection(eyeColorReader.GetOutputPort()); eyeColorTexture2.InterpolateOn(); eyeColorTexture2.SetInputConnection(eyeColorReader.GetOutputPort()); deciEyeColorTexture2.InterpolateOn(); deciEyeColorTexture2.SetInputConnection(eyeColorReader.GetOutputPort()); }
static public vtkProp3D genUserActor(CompontData data, vtkAlgorithmOutput vtkAlgorithmOutput, vtkProperty pro) { vtkTransform transform = vtkTransform.New(); // 用户自定义平移旋转 (先移动后旋转) transform.Translate(data.coor.pos.x, data.coor.pos.y, data.coor.pos.z); transform.RotateWXYZ(data.coor.rotate_theta, data.coor.rotate_axis.x, data.coor.rotate_axis.y, data.coor.rotate_axis.z); vtkTransformPolyDataFilter transFilter = vtkTransformPolyDataFilter.New(); transFilter.SetInputConnection(vtkAlgorithmOutput); transFilter.SetTransform(transform); //use vtkTransform (or maybe vtkLinearTransform) transFilter.Update(); //vtkShrinkPolyData shrink = vtkShrinkPolyData.New(); //shrink.SetInputConnection(transFilter.GetOutputPort()); //shrink.SetShrinkFactor(1); // 改 //vtkSTLWriter writer = vtkSTLWriter.New(); //calPolyData(polyData, 0.01); //writer.SetInputConnection(transFilter.GetOutputPort()); //writer.SetFileName("test.stl"); //writer.Update(); vtkPolyDataMapper mapper = vtkPolyDataMapper.New(); mapper.SetInputConnection(transFilter.GetOutputPort()); mapper.ScalarVisibilityOff(); // The actor links the data pipeline to the rendering subsystem vtkActor actor = vtkActor.New(); actor.SetProperty(pro); actor.SetMapper(mapper); return(actor); }
/// <summary> /// Loads the Squirrel model and textures /// into the algorithms and textures /// </summary> public void loadSquirrel() { //Set a predefined position for the eyes //that matches the .blend file eyeX = 0.076; eyeY = -0.178; eyeZ = 0.675; //load the squirrel model and textures if //they are not already loaded if (!squirrelLoaded) { squirrelReader.SetFileName("../../../models/squirrel.vtk"); squirrelReader.Update(); squirrelEyeReader.SetFileName("../../../models/squirrel_eyeR.vtk"); squirrelEyeReader.Update(); squirrelEyeReader2.SetFileName("../../../models/squirrel_eyeL.vtk"); squirrelEyeReader2.Update(); squirrelColorReader.SetFileName("../../../textures/squirrel_skin_col.png"); squirrelColorReader.Update(); squirrelEyeColorReader.SetFileName("../../../textures/squirrel_eyeR.png"); squirrelEyeColorReader.Update(); squirrelEyeColorReader2.SetFileName("../../../textures/squirrel_eyeL.png"); squirrelEyeColorReader2.Update(); squirrelLoaded = true; } //Set the algorithms and textures to the //ouput of the readers eyeColorTexture1.InterpolateOn(); eyeColorTexture1.SetInput(squirrelEyeColorReader.GetOutput()); deciEyeColorTexture1.InterpolateOn(); deciEyeColorTexture1.SetInput(squirrelEyeColorReader.GetOutput()); eyeColorTexture2.InterpolateOn(); eyeColorTexture2.SetInput(squirrelEyeColorReader2.GetOutput()); deciEyeColorTexture2.InterpolateOn(); deciEyeColorTexture2.SetInput(squirrelEyeColorReader2.GetOutput()); animalColorTexture.InterpolateOn(); animalColorTexture.SetInput(squirrelColorReader.GetOutput()); deciAnimalColorTexture.InterpolateOn(); deciAnimalColorTexture.SetInput(squirrelColorReader.GetOutput()); eyeData2 = squirrelEyeReader2.GetOutputPort(); eyeData1 = squirrelEyeReader.GetOutputPort(); animalData = squirrelReader.GetOutputPort(); }
/// <summary> /// Loads the Rabbit model and textures /// into the algorithms and textures /// </summary> public void loadRabbit() { //Set a predefined position for the eyes //that matches the .blend file eyeX = 0.057; eyeY = -0.311; eyeZ = 1.879; //load the rabbit model and textures if //they are not already loaded if (!rabbitLoaded) { rabbitReader.SetFileName("../../../models/rabbit.vtk"); rabbitReader.Update(); eyeReader.SetFileName("../../../models/rabbit_eye.vtk"); eyeReader.Update(); rabbitColorReader.SetFileName("../../../textures/rabbit_skin_col.png"); rabbitColorReader.Update(); eyeColorReader.SetFileName("../../../textures/rabbit_eye.png"); eyeColorReader.Update(); rabbitLoaded = true; } //Set the algorithms and textures to the //ouput of the readers animalData = rabbitReader.GetOutputPort(); eyeData1 = eyeReader.GetOutputPort(); eyeData2 = eyeData1; animalColorTexture.InterpolateOn(); animalColorTexture.SetInput(rabbitColorReader.GetOutput()); deciAnimalColorTexture.InterpolateOn(); deciAnimalColorTexture.SetInput(rabbitColorReader.GetOutput()); eyeColorTexture1.InterpolateOn(); eyeColorTexture1.SetInput(eyeColorReader.GetOutput()); deciEyeColorTexture1.InterpolateOn(); deciEyeColorTexture1.SetInput(eyeColorReader.GetOutput()); eyeColorTexture2.InterpolateOn(); eyeColorTexture2.SetInput(eyeColorReader.GetOutput()); deciEyeColorTexture2.InterpolateOn(); deciEyeColorTexture2.SetInput(eyeColorReader.GetOutput()); }
/// <summary> /// Loads the Flying Squirrel model and textures /// into the algorithms and textures /// </summary> public void loadFlyingSquirrel() { //Set a predefined position for the eyes //that matches the .blend file eyeX = 0.054; eyeY = -0.189; eyeZ = 0.427; //load the flyingsquirrel model and textures if //they are not already loaded if (!flyingSquirrelLoaded) { flyingSquirrelReader.SetFileName("../../../models/flyingsquirrel.vtk"); flyingSquirrelReader.Update(); flyingSquirreleyeReader.SetFileName("../../../models/flyingsquirrel_eye.vtk"); flyingSquirreleyeReader.Update(); flyingSquirrelColorReader.SetFileName("../../../textures/flyingsquirrel_skin_col.png"); flyingSquirrelColorReader.Update(); flyingSquirrelEyeColorReader.SetFileName("../../../textures/flyingsquirrel_eye.png"); flyingSquirrelEyeColorReader.Update(); flyingSquirrelLoaded = true; } //Set the algorithms and textures to the //ouput of the readers animalData = flyingSquirrelReader.GetOutputPort(); eyeData1 = flyingSquirreleyeReader.GetOutputPort(); eyeData2 = eyeData1; animalColorTexture.InterpolateOn(); animalColorTexture.SetInput(flyingSquirrelColorReader.GetOutput()); deciAnimalColorTexture.InterpolateOn(); deciAnimalColorTexture.SetInput(flyingSquirrelColorReader.GetOutput()); eyeColorTexture1.InterpolateOn(); eyeColorTexture1.SetInput(flyingSquirrelEyeColorReader.GetOutput()); deciEyeColorTexture1.InterpolateOn(); deciEyeColorTexture1.SetInput(flyingSquirrelEyeColorReader.GetOutput()); eyeColorTexture2.InterpolateOn(); eyeColorTexture2.SetInput(flyingSquirrelEyeColorReader.GetOutput()); deciEyeColorTexture2.InterpolateOn(); deciEyeColorTexture2.SetInput(flyingSquirrelEyeColorReader.GetOutput()); }
/// <summary> /// Loads the Chinchilla model and textures /// into the algorithms and textures /// </summary> public void loadChinchilla() { //Set a predefined position for the eyes //that matches the .blend file eyeX = 0.052; eyeY = -0.144; eyeZ = 0.424; //load the chinchilla model and textures if //they are not already loaded if (!chinchillaLoaded) { chinchillaReader.SetFileName("../../../models/chinchilla.vtk"); chinchillaReader.Update(); chinchillaEyeReader.SetFileName("../../../models/chinchilla_eye.vtk"); chinchillaEyeReader.Update(); chinchillaColorReader.SetFileName("../../../textures/chinchilla_skin_col.png"); chinchillaColorReader.Update(); chinchillaEyeColorReader.SetFileName("../../../textures/chinchilla_eye.png"); chinchillaEyeColorReader.Update(); chinchillaLoaded = true; } //Set the algorithms and textures to the //ouput of the readers animalData = chinchillaReader.GetOutputPort(); eyeData1 = chinchillaEyeReader.GetOutputPort(); eyeData2 = eyeData1; animalColorTexture.InterpolateOn(); animalColorTexture.SetInput(chinchillaColorReader.GetOutput()); deciAnimalColorTexture.InterpolateOn(); deciAnimalColorTexture.SetInput(chinchillaColorReader.GetOutput()); eyeColorTexture1.InterpolateOn(); eyeColorTexture1.SetInput(chinchillaEyeColorReader.GetOutput()); deciEyeColorTexture1.InterpolateOn(); deciEyeColorTexture1.SetInput(chinchillaEyeColorReader.GetOutput()); eyeColorTexture2.InterpolateOn(); eyeColorTexture2.SetInput(chinchillaEyeColorReader.GetOutput()); deciEyeColorTexture2.InterpolateOn(); deciEyeColorTexture2.SetInput(chinchillaEyeColorReader.GetOutput()); }
public cInformation(vtkAlgorithmOutput ContourObject, cBiological3DVolume CurrentBiologicalObject, vtkHull hullFilter) { this.ContourObject = ContourObject; this.CurrentBiologicalObject = CurrentBiologicalObject; this.hullFilter = hullFilter; }