예제 #1
0
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void ReadH5Ebsd::writeFilterParameters(AbstractFilterParametersWriter* writer)

{
  writer->writeValue("InputFile", getInputFile() );
  writer->writeValue("ZStartIndex", getZStartIndex() );
  writer->writeValue("ZEndIndex", getZEndIndex() );
  writer->writeValue("UseTransformations", getUseTransformations() );
}
예제 #2
0
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void ImportR3DStack::readFilterParameters(AbstractFilterParametersReader* reader, int index)
{
  reader->openFilterGroup(this, index);
  setZStartIndex( reader->readValue("ZStartIndex", getZStartIndex()) );
  setZEndIndex( reader->readValue("ZEndIndex", getZEndIndex()) );
  setOrigin( reader->readValue("Origin", getOrigin()) );
  setResolution( reader->readValue("Resolution", getResolution()) );
  reader->closeFilterGroup();
}
예제 #3
0
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void Hex2SqrConverter::readFilterParameters(AbstractFilterParametersReader* reader, int index)
{
  reader->openFilterGroup(this, index);
  setZStartIndex( reader->readValue("ZStartIndex", getZStartIndex() ) );
  setZEndIndex( reader->readValue("ZEndIndex", getZEndIndex() ) );
  setXResolution( reader->readValue("XResolution", getXResolution() ) );
  setYResolution( reader->readValue("YResolution", getYResolution() ) );
  setEbsdFileList( reader->readValue("EbsdFileList", getEbsdFileList() ) );
  reader->closeFilterGroup();
}
예제 #4
0
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
int Hex2SqrConverter::writeFilterParameters(AbstractFilterParametersWriter* writer, int index)
{
  writer->openFilterGroup(this, index);
  writer->writeValue("ZStartIndex", getZStartIndex() );
  writer->writeValue("ZEndIndex", getZEndIndex() );
  writer->writeValue("XResolution", getXResolution() );
  writer->writeValue("ZYResolution", getYResolution() );
  writer->writeValue("EbsdFileList", getEbsdFileList() );
  writer->closeFilterGroup();
  return ++index; // we want to return the next index that was just written to
}
예제 #5
0
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
int ImportR3DStack::writeFilterParameters(AbstractFilterParametersWriter* writer, int index)
{
  writer->openFilterGroup(this, index);
  /* FILTER_WIDGETCODEGEN_AUTO_GENERATED_CODE BEGIN*/
  writer->writeValue("ZStartIndex", getZStartIndex() );
  writer->writeValue("ZEndIndex", getZEndIndex() );
  writer->writeValue("Origin", getOrigin() );
  writer->writeValue("Resolution", getResolution() );

  writer->closeFilterGroup();
  return ++index; // we want to return the next index that was just written to
}
예제 #6
0
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void EbsdToH5Ebsd::readFilterParameters(AbstractFilterParametersReader* reader, int index)
{
  reader->openFilterGroup(this, index);
  setOutputFile( reader->readValue("OutputFile", getOutputFile()) );
  setZStartIndex( reader->readValue("ZStartIndex", getZStartIndex()) );
  setZEndIndex( reader->readValue("ZEndIndex", getZEndIndex()) );
  setZResolution( reader->readValue("ZResolution", getZResolution()) );
  setSampleTransformationAngle( reader->readValue("SampleTransformationAngle", getSampleTransformationAngle()) );
  setSampleTransformationAxis( reader->readValue("SampleTransformationAxis", getSampleTransformationAxis()) );
  setEulerTransformationAngle( reader->readValue("EulerTransformationAngle", getEulerTransformationAngle()) );
  setEulerTransformationAxis( reader->readValue("EulerTransformationAxis", getEulerTransformationAxis()) );
  setRefFrameZDir( static_cast<Ebsd::RefFrameZDir>( reader->readValue("RefFrameZDir", getRefFrameZDir() ) ) );
  setEbsdFileList( reader->readValue("EbsdFileList", getEbsdFileList()) );
  reader->closeFilterGroup();
}
예제 #7
0
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
int EbsdToH5Ebsd::writeFilterParameters(AbstractFilterParametersWriter* writer, int index)
{
  writer->openFilterGroup(this, index);
  writer->writeValue("OutputFile", getOutputFile());
  writer->writeValue("ZStartIndex", getZStartIndex());
  writer->writeValue("ZEndIndex", getZEndIndex());
  writer->writeValue("ZResolution", getZResolution());
  writer->writeValue("SampleTransformationAngle", getSampleTransformationAngle());
  writer->writeValue("SampleTransformationAxis", getSampleTransformationAxis());
  writer->writeValue("EulerTransformationAngle", getEulerTransformationAngle());
  writer->writeValue("EulerTransformationAxis", getEulerTransformationAxis());
  writer->writeValue("RefFrameZDir", getRefFrameZDir());
  writer->writeValue("EbsdFileList", getEbsdFileList());
  writer->closeFilterGroup();
  return ++index; // we want to return the next index that was just written to
}
예제 #8
0
void CropVolumePipeline::execute()
{
    VoxelDataContainer* m = getVoxelDataContainer();
  float m_MisorientationTolerance = 5.0f;
  float m_AlignMisorientationTolerance = 5.0f;
  float m_Zres = 4.0f;
  int m_MinAllowedGrainSize = 10;
  int m_MinNumNeighbors = 1;
  int m_PhaseNumberMinSize = 1;
  int m_NumIterations_Erode = 3;
  int NUM_OF_CROPS = getNumLinesinFile(m_InputFile);

  std::vector<int> m_Xmin(NUM_OF_CROPS+1, 0);
  std::vector<int> m_Ymin(NUM_OF_CROPS+1, 0);
  std::vector<int> m_Zmin(NUM_OF_CROPS+1, 0);
  std::vector<int> m_Xmax(NUM_OF_CROPS+1, 0);
  std::vector<int> m_Ymax(NUM_OF_CROPS+1, 0);
  std::vector<int> m_Zmax(NUM_OF_CROPS+1, 0);

  get_max_and_min_xyz_for_crop(m_Xmax, m_Ymax, m_Zmax, m_Xmin, m_Ymin, m_Zmin);

  /*  int m_Zmin = 1 ;
  int m_Xmax = 495;
  int m_Ymax = 355;
  int m_Zmax = 163;*/

for (DimType i = 1; i < NUM_OF_CROPS+1; i++)
{


      // Create our Pipeline object
      FilterPipeline::Pointer pipeline = FilterPipeline::New();




     // updateProgressAndMessage(("Loading Slices"), 10);
      ReadH5Ebsd::Pointer read_h5ebsd = ReadH5Ebsd::New();

      read_h5ebsd->setH5EbsdFile(getH5EbsdFile());
      //read_h5ebsd->setRefFrameZDir(Ebsd::LowtoHigh);
      read_h5ebsd->setZStartIndex(getZStartIndex());
      read_h5ebsd->setZEndIndex(getZEndIndex());
      read_h5ebsd->setPTypes(getPhaseTypes());
      read_h5ebsd->setQualityMetricFilters(getQualityMetricFilters());
      read_h5ebsd->setVoxelDataContainer(m);
      read_h5ebsd->execute();
      pipeline->pushBack(read_h5ebsd);



      ConvertEulerAngles::Pointer convert_euler = ConvertEulerAngles::New();
      convert_euler->setConversionType(DREAM3D::EulerAngleConversionType::DegreesToRadians);
      convert_euler->setVoxelDataContainer(m);
      convert_euler->execute();
      pipeline->pushBack(convert_euler);


      AlignSectionsMisorientation::Pointer align_sections = AlignSectionsMisorientation::New();
      align_sections->setMisorientationTolerance(m_AlignMisorientationTolerance);
      align_sections->setVoxelDataContainer(m);
      align_sections->execute();
      pipeline->pushBack(align_sections);

      CropVolume::Pointer crop_volume = CropVolume::New();
      crop_volume->setXMin(m_Xmin[i]);
      crop_volume->setYMin(m_Ymin[i]);
      crop_volume->setZMin(m_Zmin[i]);
      crop_volume->setXMax(m_Xmax[i]);
      crop_volume->setYMax(m_Ymax[i]);
      crop_volume->setZMax(m_Zmax[i]);
      crop_volume->setRenumberGrains(false);
      crop_volume->setVoxelDataContainer(m);
      crop_volume->execute();
      pipeline->pushBack(crop_volume);

      RegularizeZSpacing::Pointer regularize_z = RegularizeZSpacing::New();
      regularize_z->setInputFile(getZ_spacingfile());
      regularize_z->setZRes(m_Zres);
      regularize_z->setVoxelDataContainer(m);
      regularize_z->execute();
      pipeline->pushBack(regularize_z);

      EBSDSegmentGrains::Pointer ebsdsegment_grains = EBSDSegmentGrains::New();
      ebsdsegment_grains->setMisorientationTolerance(m_MisorientationTolerance);
      ebsdsegment_grains->setVoxelDataContainer(m);
      ebsdsegment_grains->execute();
      pipeline->pushBack(ebsdsegment_grains);

      OpenCloseBadData::Pointer erode_dilate = OpenCloseBadData::New();
      erode_dilate->setDirection(1); // 1 is erode.
      erode_dilate->setNumIterations(m_NumIterations_Erode);
      erode_dilate->setVoxelDataContainer(m);
      erode_dilate->execute();
      pipeline->pushBack(erode_dilate);

      FindNeighbors::Pointer find_neighbors = FindNeighbors::New();
      find_neighbors->setVoxelDataContainer(m);
      find_neighbors->execute();
      pipeline->pushBack(find_neighbors);


      PerPhaseMinSize::Pointer min_size = PerPhaseMinSize::New();
      min_size->setMinAllowedGrainSize(m_MinAllowedGrainSize);
      min_size->setPhaseNumber(m_PhaseNumberMinSize);
      min_size->setVoxelDataContainer(m);
      min_size->execute();
      pipeline->pushBack(min_size);

      MinNeighbors::Pointer min_neighbors = MinNeighbors::New();
      min_neighbors->setMinNumNeighbors(m_MinNumNeighbors);
      min_neighbors->setVoxelDataContainer(m);
      min_neighbors->execute();
      pipeline->pushBack(min_neighbors);

      FindSizes::Pointer find_sizes = FindSizes::New();
      //find_sizes->setDistributionType(DREAM3D::DistributionType::Beta);
      find_sizes->setVoxelDataContainer(m);
      find_sizes->execute();
      pipeline->pushBack(find_sizes);


      FindShapes::Pointer find_shapes = FindShapes::New();
      //find_shapes->setDistributionType(DREAM3D::DistributionType::Beta);
      find_shapes->setVoxelDataContainer(m);
      find_shapes->execute();
      pipeline->pushBack(find_shapes);



      FieldDataCSVWriter::Pointer field_data_write_csv = FieldDataCSVWriter::New();
      std::string field_csv =  "D:/IN100_run1/DREAM3D_files/crop_line_"+ convertIntToString(i) +".csv";
      field_data_write_csv->setFieldDataFile(field_csv);
      field_data_write_csv->setVoxelDataContainer(m);
      field_data_write_csv->execute();
      pipeline->pushBack(field_data_write_csv);



      bool m_WriteVtkFile = true ;
      bool m_WriteBinaryVTKFiles= true ;
      bool m_WriteGrainID= true;
      bool m_WritePhaseId= true ;
      bool m_WriteIPFColor= true ;
      bool m_WriteGoodVoxels= true ;
      bool m_WriteGrainSizes = true ;
      bool m_WriteBandContrasts = true ;

      VtkRectilinearGridWriter::Pointer vtkWriter = VtkRectilinearGridWriter::New();

      if(m_WriteVtkFile)
      {
        std::string vtk_file = "D:/IN100_run1/DREAM3D_files/crop_line_" + convertIntToString(i) + ".vtk";
        vtkWriter->setOutputFile(vtk_file);
        vtkWriter->setWriteGrainIds(m_WriteGrainID);
        vtkWriter->setWritePhaseIds(m_WritePhaseId);
        vtkWriter->setWriteBandContrasts(m_WriteBandContrasts);
        vtkWriter->setWriteGoodVoxels(m_WriteGoodVoxels);
        vtkWriter->setWriteIPFColors(m_WriteIPFColor);
        vtkWriter->setWriteBinaryFile(m_WriteBinaryVTKFiles);
        vtkWriter->setWriteBinaryFile(m_WriteGrainSizes);
        vtkWriter->setVoxelDataContainer(m);
        vtkWriter->execute();
        pipeline->pushBack(vtkWriter);
      }

      DataContainerWriter::Pointer writer = DataContainerWriter::New();
      std::string dream_3d_file = "D:/IN100_run1/DREAM3D_files/crop_line_" + convertIntToString(i) + ".dream3d";
      writer->setOutputFile(dream_3d_file);
      writer->setVoxelDataContainer(m);
      pipeline->pushBack(writer);
      writer->execute();



    //  std::cout << "********* RUNNING PIPELINE **********************" << std::endl;
    // // pipeline->run();
      pipeline->clear();


      //delete [] m;
      m->clearCellData();
      m->clearEnsembleData();
      m->clearFieldData();



}
}